Created
May 16, 2014 20:49
-
-
Save jmg/4760d7cc6586fe7d8c0b to your computer and use it in GitHub Desktop.
Configuration for multiple environments in manage.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
# By default assume it's local environment | |
env = os.environ.get("ENV", "LOCAL") | |
# PROD/DEV/LOCAL are values the environment variable ENV can have. | |
# Example for production server: ~$ export ENV=PROD | |
settings_files = { | |
"PROD": "production_settings", | |
"DEV": "development_settings", | |
"LOCAL": "local_settings", | |
} | |
settings_file = settings_files.get(env) | |
try | |
settings = __import__(settings_file, globals(), locals()) # Assumed to be in the same directory. | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment