在我的Django应用中,我需要代理用户向其他服务器的请求。我使用
当我用
也许我应该使用
为什么使用
asyncio/aiohttp客户端
。#user->request
.....
loop = asyncio.get_event_loop()
future = asyncio.ensure_future(self.run(t1, t2, t3))
loop.run_until_complete(future)
......
# response
当我用
python manager.py runserver
启动我的django服务器时,当用户请求时会出现下面的错误:
但是如果我用RuntimeError: There is no current event loop in thread 'Thread-1'.
Gunicorn
启动,一切都正常。也许我应该使用
new_event_loop
?为什么使用
Gunicorn
没有问题呢?