I have the following code in one of my views.py:
tl_key = os.getenv("TRANSLOADIT_KEY")
tl_secret = os.getenv("TRANSLOADIT_SECRET")
if not tl_key:
logger.critical("TRANSLOADIT_KEY not set")
raise ImproperlyConfigured
if not tl_secret:
logger.critical("TRANSLOADIT_SECRET not set")
raise ImproperlyConfigured
I know that if Django doesn't find SECRET_KEY or DEBUG environment variable, it will raise ImproperlyConfigured exception. Is there a way I can specify which env variables are required so that the said exception is raised automatically?