Skip to main content

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​

MethodWhen to use
PyPI (pip install caddysnake)Day-to-day development
Standalone binaryNo system Python on the host
DockerContainers
Build from sourceCustom Caddy builds

Full CLI flags live in the configuration reference.

Next steps​