WSGI and ASGI
PronunciationWIZ-gee and AZ-gee
Definition
WSGI and ASGI are the standards that connect a Python web app to a web server. WSGI is the older, synchronous one; ASGI also supports async code and long-lived connections such as WebSockets.
Where you hear it
In deployment guides (Gunicorn for WSGI, Uvicorn for ASGI), Django's wsgi.py and asgi.py files, and FastAPI docs.
Examples
Run the app with Gunicorn using the WSGI entry point.
FastAPI is ASGI, so it needs Uvicorn rather than plain Gunicorn workers.
The Django app runs under a WSGI server, while the chat service uses ASGI.
Common mistake
Using the development server in production. Put a real WSGI or ASGI server (behind a reverse proxy) in front of the app.
Don't confuse with
A web framework, which is your application code. WSGI and ASGI are only the contract between that code and the server.
Say it at work
- In a meeting or chat
Which interface does this project use, WSGI or ASGI?
- In an email or ticket
Point Gunicorn at the WSGI application object.