You can buy a house after filing bankruptcy.
For some reason, mainly propaganda from creditors like American Express, some people think after you file bankruptcy you can never buy a home. That is not true. You only have to wait two years after bankruptcy to get an fha loan, obviously you need to rebuild your credit too, such as by using a secured credit card.