Created
March 26, 2018 11:02
-
-
Save yehgdotnet/339b37910f3f4c32523a379f4673b6d8 to your computer and use it in GitHub Desktop.
Django - Load Environment variables for safe handling of password/key
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
def load_env(env_name): | |
import os | |
if not os.environ.get(env_name): | |
print(env_name + " is not defined") | |
raise SystemExit | |
else: | |
env_name = os.environ[env_name] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment