forked from M-Labs/web2019
feat(issue22/server-flask): Uses python-dotenv to avoid source manually env vars
This commit is contained in:
parent
e39a6cf6b0
commit
89181fbf82
@ -1,11 +1,8 @@
|
|||||||
from os import environ
|
from dotenv import load_dotenv
|
||||||
|
from os import getenv
|
||||||
|
|
||||||
|
|
||||||
def getenv(env, default=None):
|
load_dotenv()
|
||||||
envar = environ.get(env, default)
|
|
||||||
if envar is None:
|
|
||||||
raise ValueError('envvar %s is missing' % env)
|
|
||||||
return envar
|
|
||||||
|
|
||||||
|
|
||||||
DEBUG = True if getenv('FLASK_DEBUG') == 'True' else False
|
DEBUG = True if getenv('FLASK_DEBUG') == 'True' else False
|
||||||
|
@ -6,5 +6,6 @@ Flask-Mail==0.9.1
|
|||||||
itsdangerous==1.1.0
|
itsdangerous==1.1.0
|
||||||
Jinja2==2.11.1
|
Jinja2==2.11.1
|
||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
|
python-dotenv==0.12.0
|
||||||
six==1.14.0
|
six==1.14.0
|
||||||
Werkzeug==1.0.1
|
Werkzeug==1.0.1
|
||||||
|
Loading…
Reference in New Issue
Block a user