Created
September 27, 2016 12:09
-
-
Save tclarke/218e89dbe2b597e20e942a80eb709459 to your computer and use it in GitHub Desktop.
Django settings overrides from env variables
This file contains 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
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