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 from mycode.PollingManager import PollingManager 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()) #启动巡检线程 PM = PollingManager() PM.run_polling()