You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
1.1 KiB

import asyncio
import os
from mycode.TaskManager import g_TaskM
from web import create_app
from hypercorn.asyncio import serve
from hypercorn.config import Config
async def run_quart_app():
app = create_app()
config = Config()
config.bind = ["0.0.0.0:5001"]
config.use_reloader = True # 启用热重载
config.reload_include_patterns = ["*.py", "templates/*", "static/*"] # 监控模板和静态文件
# Enable HTTPS
# config.certfile = "cert.pem" # Path to your certificate file
# config.keyfile = "key.pem" # Path to your private key file
# config.alpn_protocols = ["http/1.1"]
await serve(app, config)
#-------------------测试相关----------------------
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print(f"Current working directory (run.py): {os.getcwd()}")
#加载未完成的工作继续执行
g_TaskM.load_tasks()
#启动web项目--hypercorn
asyncio.run(run_quart_app())
#Uvicom启动
#uvicorn.run("run:app", host="0.0.0.0", port=5001, workers=4, reload=True)