-
Notifications
You must be signed in to change notification settings - Fork 1
/
quart_app_entry.py
46 lines (39 loc) · 1.43 KB
/
quart_app_entry.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
35
36
37
38
39
40
41
42
43
44
45
46
from quart import Quart
from export.blue_project import project as blueprint_project
from export.blue_task import task as blueprint_task
import logging
class Config:
IS_DEBUG = True
class ServerAPP:
cfg = Config()
app = Quart(__name__, static_folder='dist')
app.register_blueprint(blueprint=blueprint_project)
app.register_blueprint(blueprint=blueprint_task)
@classmethod
def start(cls):
if cls.cfg.IS_DEBUG:
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
print("启动程序#日志打印:", loggers)
cls.app.run(host="0.0.0.0", port=5031, debug=False)
else:
import asyncio
from hypercorn.config import Config
from hypercorn.asyncio import serve
config = Config()
config._bind = ["0.0.0.0:5031"]
config.keep_alive_timeout = 0.0
config.shutdown_timeout = 0.0
# app.logger.setLevel(logging.DEBUG)
asyncio.run(serve(cls.app, config))
# clean()
# os.system("unset http_proxy")
# os.system("unset https_proxy")
# import uvloop
#
# uvloop.install()
# import uvicorn
#
# uvicorn.run(app, host="0.0.0.0",
# port=5031,
# loop="uvloop",
# log_level="warning")