【发布时间】:2020-09-19 10:19:16
【问题描述】:
我需要这个简单程序的帮助,我不确定这个 tornado 应用程序是否是异步的(我添加了 async/await),但我相信我应该添加一些东西。 我希望程序异步监听请求,提前谢谢。
import tornado.web
import tornado.ioloop
import fun, func2
class A(tornado.web.Application):
async def post(self):
result = await func2()
class B(tornado.web.Application):
async def put(self):
result = await func()
def main():
app = tornado.web.Application([
(r"/A", A),
(r"/B", B)
])
return app
if __name__ == "__main__":
app = main()
app.listen(8000)
tornado.ioloop.IOLoop.current().start()
【问题讨论】:
-
这能回答你的问题吗? Tornado and asynchronous
标签: python asynchronous async-await tornado