forked from geocompass/robosat_geoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·34 lines (29 loc) · 822 Bytes
/
main.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
27
28
29
30
31
32
33
34
"""
Created by wucan on 2019-10-15.
"""
from flask_apscheduler import APScheduler
from werkzeug.exceptions import HTTPException
from app import create_app
from app.libs.error import APIException
from app.libs.error_code import ServerError
from app.api.v1.job import scheduler
app = create_app()
@app.errorhandler(Exception)
def framework_error(e):
if isinstance(e, APIException):
return e
if isinstance(e, HTTPException):
code = e.code
msg = e.description
error_code = 1007
return APIException(msg, code, error_code)
else:
# 调试模式
# log
if not app.config['DEBUG']:
return ServerError()
else:
raise e
if __name__ == '__main__':
scheduler.start()
app.run(host='0.0.0.0', port=5000, debug=False)