The purpose of this project is to provide examples of how we can use (integrate) different Python Web Frameworks together using a2wsgi.
Who likes migration? But in some cases, it's necessary. a2wsgi helps us to convert our ASGI applications to WSGI or vice versa.
A Scenario (that I have faced): You have a Flask application and you want to migrate it to FastAPI. You have two options:
- Rewrite the whole application from scratch and deploy it when it's ready.
- Use a2wsgi to convert your Flask application to WSGI using a2wsgi and then integrate (mount) it to your FastAPI application and deploy it. By the time, you can rewrite your application step by step.
| Framework | Mount | Protocol | Notes |
|---|---|---|---|
| Flask | ✅ | WSGI | Full app with cookie endpoints |
| FastAPI | ✅ | ASGI | Full app with cookie endpoints |
| Django | ✅ | WSGI | |
| Starlette | ✅ | ASGI | |
| Litestar | ✅ | ASGI | |
| BlackSheep | ✅ | ASGI | ASGI shim — requires own lifecycle for full app mount |
| Quart | ✅ | ASGI | |
| Falcon | ✅ | WSGI | |
| Sanic | ✅ | ASGI | ASGI shim — manages own event loop |
| Connexion | ✅ | ASGI | Fallback shim when not installed |
| Bottle | ✅ | WSGI | |
| Robyn | ✅ | WSGI | WSGI shim — no WSGI/ASGI adapter available |
| HUG | ✅ | WSGI | |
| Tornado | ✅ | WSGI | WSGI shim — runs own IOLoop, no adapter |
| Pyramid | ✅ | WSGI | |
| webapp2 | ✅ | WSGI | Fallback shim when not installed |
| aiohttp | ✅ | ASGI | ASGI shim — no native ASGI sub-app mounting |
| Framework | Mount |
|---|---|
| Gradio | ✅ |
| PyWebIO | ✅ |
| Flet | ✅ |
| NiceGUI | 🚧 |
| Reflex | 🚧 |
| Streamlit | 🔳 |
| Plotly Dash | 🔳 |
Emoji key:
- ✅: Accomplished
- 🔳: Not tried yet
- ❌: Tried and failed
- 🚧: In progress
⚠️ : Not sure if possible
- Python 3.10+
- uv
- Docker & Docker Compose (optional)
uv sync
uv run uvicorn app.main:app --reloaddocker compose up --buildGo to http://localhost:8000/docs to see the API documentation.
uv run pytest tests/ -vIf you would like to contribute to this project, please open an issue or submit a pull request.
- Frameworks that run on WSGI — WSGI.org
- Implementations — ASGI 3.0 documentation
- Application Dispatching — Flask Documentation (3.0.x)
- Sub Applications - Mounts - FastAPI
- hasansezertasan, It's me 👋
This project is licensed under the MIT License - see the LICENSE file for details.