Created
August 24, 2016 22:15
-
-
Save diogobaeder/0558c43d785cd82a1ecff553bc583867 to your computer and use it in GitHub Desktop.
Gist to show uvloop problems with aiohttp serving static files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Gist to show uvloop problems with aiohttp serving static files. | |
""" | |
import logging | |
import asyncio | |
import uvloop | |
from aiohttp import web | |
logging.basicConfig(level=logging.DEBUG) | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) | |
def create_app(loop): | |
app = web.Application(loop=loop, logger=logging) | |
app.router.add_static('/', '.') | |
return app | |
if __name__ == '__main__': | |
loop = asyncio.get_event_loop() | |
app = create_app(loop) | |
web.run_app(app, host='localhost', port=8765) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment