Created
February 17, 2014 20:25
-
-
Save idan/9058394 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from django.core.exceptions import ImproperlyConfigured | |
def get_env_variable(var_name): | |
""" Get the environment variable or return an exception """ | |
try: | |
return os.environ[var_name] | |
except KeyError: | |
error_msg = "Set the {} environment variable".format(var_name) | |
raise ImproperlyConfigured(error_msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment