DEBUG flag can now be set via config and environment
This commit is contained in:
parent
b02938cafe
commit
958a9bdd9f
7
main.py
7
main.py
|
@ -1,12 +1,17 @@
|
||||||
import os
|
import os
|
||||||
from app import app
|
from app import app
|
||||||
import logging
|
import logging
|
||||||
|
from config import config
|
||||||
|
|
||||||
|
|
||||||
def setup_logging():
|
def setup_logging():
|
||||||
logging.basicConfig(format='%(asctime)s [%(levelname)s]: %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(asctime)s [%(levelname)s]: %(message)s', level=logging.INFO)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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()
|
setup_logging()
|
||||||
app.run(debug=DEBUG, host='0.0.0.0')
|
app.run(debug=DEBUG, host='0.0.0.0')
|
||||||
|
|
Loading…
Reference in New Issue