diff --git a/web.py b/web.py index b796199..a94f2a6 100644 --- a/web.py +++ b/web.py @@ -117,9 +117,20 @@ async def main() -> None: app.static("assets", "assets", name="assets") if __name__ == "__main__": - loop = asyncio.new_event_loop() + if sys.platform == "win32": + loop = asyncio.new_event_loop() + else: + import uvloop + loop = uvloop.new_event_loop() + asyncio.set_event_loop(loop) + try: loop.run_until_complete(main()) except KeyboardInterrupt: print("Exiting...") +else: + if sys.platform == "win32": + app.config.USE_UVLOOP = False + else: + app.config.USE_UVLOOP = True \ No newline at end of file