Skip to content

Instantly share code, notes, and snippets.

@andy23512
Created March 2, 2019 01:15
Show Gist options
  • Save andy23512/6a5c6488c2576be1bf1b659a45c380e5 to your computer and use it in GitHub Desktop.
Save andy23512/6a5c6488c2576be1bf1b659a45c380e5 to your computer and use it in GitHub Desktop.
Demonstration of overriding Django settings in different environment(e.g. development, test, production, ...)
from web.settings import * # import all settings from base settings web/settings.py
# overriding the settings
FORCE_SCRIPT_NAME = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': config['TEST_DATABASE']['name'], # this config comes from config.ini file
'USER': config['TEST_DATABASE']['username'],
'PASSWORD': config['TEST_DATABASE']['password'],
'HOST': config['TEST_DATABASE']['host'],
'PORT': config['TEST_DATABASE']['port'],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment