Skip to content

Instantly share code, notes, and snippets.

@yehgdotnet
Created March 26, 2018 11:02
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 yehgdotnet/339b37910f3f4c32523a379f4673b6d8 to your computer and use it in GitHub Desktop.
Save yehgdotnet/339b37910f3f4c32523a379f4673b6d8 to your computer and use it in GitHub Desktop.
Django - Load Environment variables for safe handling of password/key
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