from sanic import Sanic
from sanic.response import text
import asyncio
app = Sanic("app")
@app.get("/")
async def async_handler(request):
await asyncio.sleep(2)
return text("Done.")
start with sanic server
Then I start two browser tabs and go to http://127.0.0.1:8000/ but they run after each other and not in parallel.
Sanic v25.3.0 │
│ Goin' Fast @ http://127.0.0.1:8000 │
├───────────────────────┬────────────────────────────────────────────────┤
│ │ app: app │
│ ▄███ █████ ██ │ mode: production, single worker │
│ ██ │ server: sanic, HTTP/1.1 │
│ ▀███████ ███▄ │ python: 3.12.3 │
│ ██ │ platform: Linux-6.8.0-31-generic-x86_64-with-g │
│ ████ ████████▀ │ libc2.39 │
│ │ packages: sanic-routing==23.12.0 │
│ Build Fast. Run Fast. │ │