Do you want to be mortgage-free by the time you retire? If yes, then what you can afford to pay down each month will come into play. I used a combination of a simple savings calculator and a mortgage calculator with various extra payments to run a bunch of scenarios of projected retirement dates. Knowing your target retirement date and expected retirement expenses is the most important--you can flex from there is the amount you'd need to pay extra on your mortgage is too much (you either push out retirement date, buy a less expensive house, or reduce your after-retirement spending).
At any rate, there are a lot of variables to play with, but a geek like me finds that fun! And housing is one of the things I'll pay more for to be where I want to be in a safe neighborhood with good schools and some character.
Good luck!