Display failure messages when environment variables missing

Running migrate initially as specified from README leads to a cryptic
"CONFIG ERROR" failure message. Print out what variables are actually
missing.
This commit is contained in:
Jamie Lennox 2017-06-10 12:00:31 +10:00
parent a0d8fa43d9
commit 2eb2383b6c

View file

@ -61,11 +61,25 @@ saml2_contact = {
'email_address': os.environ.get('META_EMAIL', 'op@example.com'),
'contact_type': 'technical'},
fail = False
if (SECRET_KEY is None or PINAX_STRIPE_PUBLIC_KEY is None or
PINAX_STRIPE_SECRET_KEY is None):
sys.exit('CONFIG ERROR')
if SECRET_KEY is None:
print("FAILURE: You need to supply a DJANGO_SECRET_KEY "
"environment variable")
fail = True
if PINAX_STRIPE_PUBLIC_KEY is None:
print("FAILURE: You need to supply a STRIPE_PUBLIC_KEY "
"environment variable")
fail = True
if PINAX_STRIPE_SECRET_KEY is None:
print("FAILURE: You need to supply a STRIPE_SECRET_KEY "
"environment variable")
fail = True
if fail:
sys.exit('FAILURE: Missing environment variables.')
### Standard settings