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:
		
							parent
							
								
									a0d8fa43d9
								
							
						
					
					
						commit
						2eb2383b6c
					
				
					 1 changed files with 17 additions and 3 deletions
				
			
		|  | @ -61,11 +61,25 @@ saml2_contact = { | ||||||
|     'email_address': os.environ.get('META_EMAIL', 'op@example.com'), |     'email_address': os.environ.get('META_EMAIL', 'op@example.com'), | ||||||
|     'contact_type': 'technical'}, |     'contact_type': 'technical'}, | ||||||
| 
 | 
 | ||||||
|  | fail = False | ||||||
| 
 | 
 | ||||||
| if (SECRET_KEY is None or PINAX_STRIPE_PUBLIC_KEY is None or | if SECRET_KEY is None: | ||||||
|    PINAX_STRIPE_SECRET_KEY is None): |     print("FAILURE: You need to supply a DJANGO_SECRET_KEY " | ||||||
|     sys.exit('CONFIG ERROR') |           "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 | ### Standard settings | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Jamie Lennox
						Jamie Lennox