freedomsponsors/www.freedomsponsors.org — pull request #122 by henriquebastos (2012-12-31 19:37:59+00:00)
Title: New settings strategy

With this PR, I propose we change the relationship between `settings.py` and `env_settings.py`.

Currently, `settings.py` **explicitly assigs** a configuration parameter to a variable defined in `env_settings.py`.

This forces both files to continuously grow in a 1-1 rate and any new parameter will break users and developers envs.

IMO, a better strategy is to use `env_settings.py` to override `settings.py` values.

The benefits are:

1. Enables settings.py to explicitly define default values, leaving to the env_settings.py only what should be different.
1. settings.py will be more plain and easier to read.
2. env_settings.py can be adapted to be [12 Factors](http://www.12factor.net/) compliant, importing environment values from the host shell.
3. New settings won't necessary break users and developers environment.

What's here:

- `env_settings.py` overriding `settings.py`;
- Added [Unipath](http://pypi.python.org/pypi/Unipath/) for better directory manipulation;
- Added [dj-database-url](http://pypi.python.org/pypi/dj-database-url/) to try to load database config from host shell or default to local a sqlite db.
- Removed complicated conditions. Now you can simply override parameters;
- Moved default values from `env_settings.py` to `settings.py`;

> NOTE: This should not be directly merged! It should be tested on ambtest first. I won't be able to do it until jan 14th, so if any developer with better experience on ambtest could do it, it would be great.