Django Multiple Settings with Single File
By Rayed
Instead of having multiple settings files one for production and one for development and so on, I prefer to use an “if” statement with environment variable:
ENV = os.environ.get(‘DJANGO_ENV’, ‘’)
print “==== Active Env: [%s] ====” % (ENV)
if ENV == “dev”:
# DEBUG
DEBUG = True
TEMPLATE_DEBUG = DEBUG
else:
DEBUG = False
TEMPLATE_DEBUG = False
Then from your “.bashrc” file:
export DJANGO_ENV=dev