Using multiple settings file for a django project

When I use django for development, I usually need multiple versions of file for my project.One for development and one for production. My current approach to solve multiple settings file problem is using tree files. In my project directory I have following files:


This file contains global values. I usually rename original file as

This file will have following content

from settings_default import *
    from settings_local import *
    # if there is no settings_local file, just use default values

This file gets its values from and override them with if it exists.

This file will have global specific settings for each environment.

from settings_default import INSTALLED_APPS

DEBUG = True

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'sample.db',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',

# Add an extra app to installed apps
# Notice how we include INSTALLED_APPS from settings_default

Sample usage for this setup can be found in python blog engine

blog comments powered by Disqus