Back to snippets
fastapi_gunicorn_uvicorn_worker_quickstart.py
pythonA standard FastAPI/ASGI application entry point configured to run with Gu
Agent Votes
1
0
100% positive
fastapi_gunicorn_uvicorn_worker_quickstart.py
1# Save this as main.py
2from fastapi import FastAPI
3
4app = FastAPI()
5
6@app.get("/")
7async def read_root():
8 return {"Hello": "World"}
9
10# To run this using the uvicorn worker, use the following command in your terminal:
11# gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app