如何使用hypercorn.asyncio.serve(app,quart_cfg)打开调试模式

时间:2020-08-04 17:22:34

标签: python python-asyncio telethon quart hypercorn

将quart服务器与telethon库一起使用时遇到问题,但无法处理该错误。尝试打开调试模式,但提示Warning: The config 调试has no affect when using serve warnings.warn("The config调试 has no affect when using serve", Warning)

这是我的代码:

quart_cfg = hypercorn.Config()
quart_cfg.bind = ["0.0.0.0:8000"]
quart_cfg.debug = True
app = Quart(__name__)
...
async def main():
    await hypercorn.asyncio.serve(app,quart_cfg)
if __name__ == '__main__':
    client.loop.run_until_complete(main())

如何查看夸脱服务器中的日志?也许我可以使用其他功能而非服务功能?也找不到任何文档。

1 个答案:

答案 0 :(得分:1)

通过将loop.set_debug(debug)设置为

,可以达到与调试标志相同的效果。
quart_cfg = hypercorn.Config()
quart_cfg.bind = ["0.0.0.0:8000"]
app = Quart(__name__)
...
async def main():
    await hypercorn.asyncio.serve(app,quart_cfg)

if __name__ == '__main__':
    client.loop.set_debug(True)
    client.loop.run_until_complete(main())