Instead of:
settings.py
You can have a structure like this:
settings/
base.py
development.py
staging.py
production.py
base.py contains all the common settings.
development.py imports all the settings from base.py and overwrites necessary settings for the development server something like this:
from your_app.settings.base import *
A_SETTING_TO_CHANGE = DIFFERENT_VALUE_FOR_DEVELOPMENT
staging.py imports all the settings from base.py and overwrites necessary settings for the staging server something like this:
from your_app.settings.base import *
A_SETTING_TO_CHANGE = DIFFERENT_VALUE_FOR_STAGING
production.py imports all the settings from base.py and overwrites necessary settings for the production server something like this:
from your_app.settings.base import *
A_SETTING_TO_CHANGE = DIFFERENT_VALUE_FOR_PRODUCTION
Then in wsgi.py and manage.py change:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_app.settings')
To:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_app.settings.development')
In the staging server, set the DJANGO_SETTINGS_MODULE environment variable to 'your_app.settings.staging'.
In the production server, set the DJANGO_SETTINGS_MODULE environment variable to 'your_app.settings.production'.