Skip to content

enable auto reload for fastapi in local environment#11584

Merged
cdrini merged 2 commits intomasterfrom
fastapi-auto-reload
Dec 17, 2025
Merged

enable auto reload for fastapi in local environment#11584
cdrini merged 2 commits intomasterfrom
fastapi-auto-reload

Conversation

@RayBB
Copy link
Copy Markdown
Collaborator

@RayBB RayBB commented Dec 11, 2025

Closes #
Currently, any change to a FastAPI endpoint requires manually restarting the Docker container.

This PR switches the dev container from gunicorn to uvicorn --reload, enabling instant code reloading without restarts.

Note: gunicorn --reload does not work reliably with FastAPI (see benoitc/gunicorn#2339). The recommendation is to use Uvicorn for development. This introduces a minor difference between local/dev and production (which still uses Gunicorn), but the productivity gain far outweighs the divergence.

Also, for this PR I am following the convention of LOCAL_DEV=true that we use for the web.py container.

Technical

Testing

Screenshot

Stakeholders

Copy link
Copy Markdown
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@cdrini cdrini merged commit 2a544d1 into master Dec 17, 2025
6 of 7 checks passed
@cdrini cdrini deleted the fastapi-auto-reload branch December 17, 2025 18:02
mystic-06 pushed a commit to mystic-06/openlibrary that referenced this pull request Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants