Run Django, Flask and FastAPI sites locally

On this page

Short Leash serves Python web apps with granian, one worker per site, started on the first request and reloaded when your code changes.

What Short Leash recognizes

  • Django: manage.py. Short Leash reads the settings module from it and uses asgi.py when the project uses Channels or Daphne, otherwise wsgi.py.
  • FastAPI, Starlette and Flask: an app object such as app = FastAPI() in main.py, app.py, server.py, api.py, app/main.py, src/main.py, app/__init__.py or src/app.py.

Python versions and packages

Short Leash starts each site with uv run, which installs the Python version and the packages before the worker starts:

  • With pyproject.toml, uv syncs the project's .venv from it (and from uv.lock when there is one).
  • With only requirements.txt, uv installs the requirements into an environment it caches outside the project, so no .venv appears in the site's folder.

The version comes from .python-version when the project has one; otherwise the default on the Runtimes screen. Pin a site with:

Terminal window
leash isolate 3.12 --site ledger-api

The worker's output is in Logs under the site's name.