onaio/onadata — pull request #192 by vernondcole (2014-03-08 16:04:04+00:00)
Title: Improved structured settings

I was not very happy with he version of structured settings which was in place when ona was forked from formhub. It was funky in too many ways. This is my new and improved version. The highlights are:
1) settings.py is moved back to its traditional name and place -- you can find it again.
2) the folder where the structured settings files are is renamed to "preset" (so the name does not conflict with the name of settings.py). The name kind of implies what the files there are for.
3) preset/default_settings.py is much smarter and more capable, so that...
4) 12-factor configuration using DATABASE_URL is enabled by default.
5) DATABASE_URL can pass arbitrary information to settings scripts, using the ?query part of the URL.
6) a new preset/local_preset.py is defined which default_settings.py imports when URLs are not used. This is intended to replace the legitimate uses of local_settings.py in simple installations. It is pre-loaded with settings so that by default you use a postgis database on the local computer.
7) If you really, desperately _need_ local_settings.py -- it's back -- imported (from its legacy location using a relative import) by preset/default_settings at the end if its own operation. [Thanks for the hint that calling it from settings.py, as we are used to doing, could cause surprising behavior.]