Skip to content

Instantly share code, notes, and snippets.

@DarkSector
Created August 20, 2015 19:31
Show Gist options
  • Select an option

  • Save DarkSector/9e9f7ced00c2dafc84ce to your computer and use it in GitHub Desktop.

Select an option

Save DarkSector/9e9f7ced00c2dafc84ce to your computer and use it in GitHub Desktop.
Init for the distributed settings
# for our settings module
import os
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
from base import * # required because that is what we will override
# now first import local and then dev and then prod
if os.path.isfile(os.path.join(ROOT_DIR, 'settings/local.py')):
from local import *
if os.path.isfile(os.path.join(ROOT_DIR, 'settings/dev.py')):
from dev import *
# and then import prod because that has to override all the settings
if os.path.isfile(os.path.join(ROOT_DIR, 'settings/prod.py')):
from prod import *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment