DEBUG flag can now be set via config and environment

This commit is contained in:
Joachim Lusiardi 2017-11-07 22:31:31 +01:00
parent b02938cafe
commit 958a9bdd9f
1 changed files with 6 additions and 1 deletions

View File

@ -1,12 +1,17 @@
import os
from app import app
import logging
from config import config
def setup_logging():
logging.basicConfig(format='%(asctime)s [%(levelname)s]: %(message)s', level=logging.INFO)
if __name__ == '__main__':
DEBUG = 'DEBUG' in os.environ and os.environ['DEBUG'] != 'False'
c = config[os.getenv('FLASK_CONFIG') or 'default']
DEBUG = c.DEBUG
DEBUG = os.environ.get('DEBUG', DEBUG)
setup_logging()
app.run(debug=DEBUG, host='0.0.0.0')