INNER CODE UNIT · Python

startup

grillazz/fastapi-sqlalchemy-asyncpg · app/server.py:4

def startup() -> None:
    print("Server starting up...")

def shutdown() -> None:
    print("Server shutting down...")

server = Granian(
    "main:app",
    host="0.0.0.0",  # Bind to all interfaces
    port=8000,
    workers=4,
    interface="asgi",
    blocking_threads=8  # Optional: threads per worker for blocking ops
)
server.on_startup(startup)
server.on_shutdown(shutdown)
server.serve_forever()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…