Skip to content

Reload

Reload mode is a development-only process supervisor that restarts the server on file changes.

Typical command

from __future__ import annotations

command = [
    "palfrey",
    "docs_src.getting_started.hello_world:app",
    "--reload",
    "--reload-dir",
    "./src",
    "--reload-include",
    "*.py",
]

print(" ".join(command))

Equivalent CLI:

palfrey main:app --reload --reload-dir src --reload-include '*.py'

Controls

  • --reload
  • --reload-dir (repeatable)
  • --reload-include (repeatable)
  • --reload-exclude (repeatable)
  • --reload-delay

Common pattern examples

Monorepo service folder only

palfrey main:app --reload --reload-dir services/api

Include templates and Python, exclude generated files

palfrey main:app \
  --reload \
  --reload-include '*.py' \
  --reload-include '*.jinja2' \
  --reload-exclude '.venv/*' \
  --reload-exclude 'dist/*'

Troubleshooting

  • no reload events: check watched path and file patterns
  • too many restarts: tune include/exclude and delay
  • CPU overhead: narrow watch scope

Non-technical summary

Reload mode is a productivity feature for development, not a production reliability feature.