Modifying settings.py
There has been a lot of discussion about managing settings.py in Django.
SplitSettings wiki page on code.djangoproject.com is a
good summary of all sollutions that people came up with.
Importing local_settings from settings.py has become a standard in the
community. This way it is possible to put settings.py under version control
and keep sensitive data, like database connection parameters on a particular
machine. It is only possible to override and add new parameters when using
this solution. Reading and modifying default parameters in local_settings
becomes a problem.
To make modifications possible, put default settings in default_settings.py
and store it in version control. Users should create their local settings.py
with customizations and add import at beginning:
from default_settings import *
Now we can modify some parameters for development purposes only:
INSTALLED_APPS += ('debug_toolbar',)
Simple change in order of imports allows us to read default configuration and add slight modifications to it. Next step would be to call a code from settings.py that would ask user for database settings. That would ease deployment of Django projects on new sites. After all settings.py is just a piece of Python.