Created
July 23, 2015 21:33
-
-
Save PCreations/e724c0f2caa90f3f1650 to your computer and use it in GitHub Desktop.
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
import os | |
from django.core.exceptions import ImproperlyConfigured | |
def get_env_variable(var_name): | |
""" Gets the environment variable or returns exception. """ | |
try: | |
return os.environ[var_name] | |
except KeyError: | |
error_msg = "Set the {} environment variable".format(var_name) | |
raise ImproperlyConfigured | |
SECRET_KEY = get_env_variable('DJANGO_SECRET_KEY') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment