tornado
has its own event loop which is incompatible with asyncio
's event loop. But it can be solved.
First, create a BaseHandler
extended from tornado.web.RequestHandler
:
class BaseHandler(tornado.web.RequestHandler):
@staticmethod
def asyncio_task(method):
@functools.wraps(method)
async def wrapper(self, *args, **kwargs):