-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.py
26 lines (22 loc) · 773 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
import sys
import traceback
import logging
from app import create_app, check_directories, start_scheduling
from app.constants import LOG_FILE
from app.views import bp
def my_excepthook(type, value, tb):
content = traceback.format_exception(type, value, tb)
text = ''.join(content)
logging.error(text)
sys.__excepthook__(type, value, tb)
if __name__ == '__main__':
app = create_app()
app.register_blueprint(bp)
check_directories()
start_scheduling()
logging.basicConfig(filename=LOG_FILE, level=logging.DEBUG,
format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p')
sys.excepthook = my_excepthook
app.run(host='0.0.0.0', port=8080, debug=True)