Skip to content

Instantly share code, notes, and snippets.

@sobolevn
Last active April 4, 2017 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sobolevn/44147d9f0002b0f04053e5d362e7ab7b to your computer and use it in GitHub Desktop.
Save sobolevn/44147d9f0002b0f04053e5d362e7ab7b to your computer and use it in GitHub Desktop.
medium-django-split-settings.py
"""
This is a django-split-settings main file.
For more information read this:
https://github.com/sobolevn/django-split-settings
Default environment is `developement`.
To change settings file:
`DJANGO_ENV=production python manage.py runserver`
"""
from split_settings.tools import optional, include
from os import environ
ENV = environ.get('DJANGO_ENV') or 'development'
base_settings = [
'components/common.py', # standard django settings
'components/database.py', # postgres
'components/rq.py', # redis and redis-queue
'components/emails.py', # smtp
# You can even use glob:
# 'components/*.py'
# Select the right env:
'environments/%s.py' % ENV,
# Optionally override some settings:
optional('environments/local.py'),
]
# Include settings:
include(*base_settings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment