Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 612
Yury Selivanov edited this page Jul 27, 2016
·
6 revisions
Just install the uvloop event policy:
importasyncioimportuvloopasyncio.set_event_loop_policy(uvloop.EventLoopPolicy())You have to use a special gunicorn worker class that aiohttp bundles since 0.22.0:
$ gunicorn ... --worker-class aiohttp.worker.GunicornUVLoopWebWorkerStarting your application this way will automatically make asyncio.get_event_loop() to return a uvloop event loop. There is no need to manually install uvloop policy.
Install uvloop event policy before calling AsyncIOMainLoop().install():
fromtornado.platform.asyncioimportAsyncIOMainLoopimportasyncioimportuvloopasyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
AsyncIOMainLoop().install()
asyncio.get_event_loop().run_forever()