Run Django, Flask and FastAPI sites locally
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 usesasgi.pywhen the project uses Channels or Daphne, otherwisewsgi.py. - FastAPI, Starlette and Flask: an app object such as
app = FastAPI()inmain.py,app.py,server.py,api.py,app/main.py,src/main.py,app/__init__.pyorsrc/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.venvfrom it (and fromuv.lockwhen there is one). - With only
requirements.txt, uv installs the requirements into an environment it caches outside the project, so no.venvappears 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:
leash isolate 3.12 --site ledger-api
The worker's output is in Logs under the site's name.