From e3ab361cc5ae34c679fe4af394511efbe2766a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=93=E6=BE=84?= Date: Fri, 8 Dec 2023 19:47:56 +0800 Subject: [PATCH] fix: bootstrap type error --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index a844613..669a932 100644 --- a/main.py +++ b/main.py @@ -107,4 +107,10 @@ async def handle_404(request): # 404 app.router.add_route('*', '/{tail:.*}', handle_404) -web.run_app(app, host=config.read_config('common.host'), port=config.read_config('common.port')) +if (__name__ == "__main__"): + try: + web.run_app(app, host=config.read_config('common.host'), port=int(config.read_config('common.port'))) + except Exception as e: + logger.error("服务器启动失败, 请查看下方日志") + logger.error(traceback.format_exc()) +