Context Navigation

Splitting up the settings file

If you use a source control system (CVS, SVN, ...), or want to publish your application on the web,
it may be a good idea to move sensitive or machine/user specific settings like database
passwords and such out of the main settings.py file.

As discussions on the django-developers mailing list have shown everybody has different
requirements and ideas how to do this. This page is meant to collect some of these ideas for future reference.

One thing to keep in mind is that django's config files are pure python.
This gives you the ultimate flexibility to handle configurations the way you think is best.
Or to quote Adrian Holovaty:

We don't need a default solution for this. It's not within the scope
of this project to tell people how they should organize their settings
files. Take that opportunity to showcase your individualism.

Different settings in different files

I believe the first user who came up with this was Hugo, who used this method in the projects he published on ​his site.

If wanted a settings_local.template file can be put under version control with
instructions to copy it over to settings_local.py, change it to suite the environment,
and to never ever commit it to the RCS system.

# Load the production settings that we will overwrite as needed in our user1 settings file.fromprojectname.config.prodimport*
DEBUG =True
DATABASE_NAME ='devdbname'# More development/maching specific settings