Skip to content

Instantly share code, notes, and snippets.

@neara
Created May 18, 2016 15:18
Show Gist options
  • Save neara/f9d17c5418a6f7e93ccb85a9745e5eb6 to your computer and use it in GitHub Desktop.
Save neara/f9d17c5418a6f7e93ccb85a9745e5eb6 to your computer and use it in GitHub Desktop.
How init inside settings should look like for modular approach
from base import *
env = os.environ.get('ENV')
if env == 'local':
from local import *
elif env == 'prod':
from production import *
else:
from local import *
# This is how to import additional settings files for all environments
# django celery pipeline settings
from pipeline import *
# This is to allow for developers to use their own settings and override localenv settings
try:
from local_settings import *
except ImportError:
pass
@nirtayeb
Copy link

nirtayeb commented May 19, 2016

I would write it like this :)

if env == 'prod':
    from production import *
else:
    from local import *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment