Skip to content

Instantly share code, notes, and snippets.

@tclarke
Created September 27, 2016 12:09
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 tclarke/218e89dbe2b597e20e942a80eb709459 to your computer and use it in GitHub Desktop.
Save tclarke/218e89dbe2b597e20e942a80eb709459 to your computer and use it in GitHub Desktop.
Django settings overrides from env variables
for k, v in os.environ.iteritems():
if k.startswith("MYAPP_"):
try:
locals()[k[6:]] = type(locals()[k[6:]])(v)
except KeyError:
locals()[k[6:]] = v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment