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()) +