Quickstart
Caddy Snake runs Python web apps inside Caddy — no separate Gunicorn or Uvicorn process. It works with Flask, Django, FastAPI, and any other WSGI/ASGI (or ESGI) app.
Install and run
pip install caddysnake fastapi
main.py:
from fastapi import FastAPI
app = FastAPI()
@app.get("/hello")
def hello():
return {"message": "Hello world!"}
caddysnake --server-type asgi --app main:app --lifespan on
curl http://127.0.0.1:9080/hello
That starts Caddy with the plugin on port 9080. Use --domain example.com for automatic HTTPS.
Flask instead?
pip install caddysnake flask
caddysnake --server-type wsgi --app main:app
Prefer a Caddyfile?
http://localhost:9080 {
python /* {
module_asgi "main:app"
lifespan on
}
}
caddy run --config Caddyfile
Other install options
| Method | When to use |
|---|---|
PyPI (pip install caddysnake) | Day-to-day development |
| Standalone binary | No system Python on the host |
| Docker | Containers |
| Build from source | Custom Caddy builds |
Full CLI flags live in the configuration reference.
Next steps
- Examples — Django, Socket.IO, multi-tenant hostnames, autoreload
- Configuration reference — every
pythondirective - Architecture — workers, sockets, dynamic apps
- Blog: branch previews — one-box PR previews with DB clones