Skip to content

/flags/fastapi/uvicorn-reload

uvicorn --reload: auto-restart FastAPI on code changes

The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
tool
FastAPI
command
uvicorn
flag
--reload
default
off

uvicorn main:app --reload runs the ASGI app app from main.py and restarts the worker process whenever a watched file changes. By default it watches *.py files in the current directory. fastapi dev main.py (FastAPI CLI) starts Uvicorn with reload enabled; fastapi run starts it without.

Usage

bash
uvicorn main:app --reload
uvicorn main:app --reload --reload-dir src --reload-include '*.yaml'
fastapi dev main.py          # same as uvicorn with --reload, for development
OptionEffect
--reloadrestart on file changes
--reload-dir DIRdirectories to watch (repeatable); default: current directory
--reload-include GLOBextra file patterns to watch, e.g. *.html
--reload-exclude GLOBpatterns to ignore
--reload-delay SECONDSwait before restarting
--workers Nseveral worker processes; cannot be combined with --reload

Watching more than .py files

Uvicorn uses watchfiles when it is installed (pip install "uvicorn[standard]"), which is faster and is required for --reload-include and --reload-exclude patterns to work beyond the defaults.

Sources