File size: 711 Bytes
353cfb6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import uvicorn
import asyncio
import sys
import os
if __name__ == "__main__":
# Force WindowsProactorEventLoopPolicy on Windows
# This must be done before any asyncio loop is created
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
# Run Uvicorn programmatically
# DISABLE RELOAD to fix Windows Asyncio Subprocess issue
# Playwright on Windows requires the main thread's event loop to be Proactor,
# and Uvicorn's reloader messes this up.
uvicorn.run(
"app.main:app",
host="127.0.0.1",
port=8000,
reload=False,
workers=1,
loop="asyncio",
log_level="info"
)
|