fixes bug 1022805 - Explode settings/local.py-dist

@rhelmer r?

As I was going through it I noticed there are plenty of things that can be scrutinized further. I think this PR is going to make wonders for people though. The nomenclature of "dev" and "prod" is really useful.