python
config_error
ai_generated
true
WARNING: WatchFiles detected changes in 'app/main.py'. Reloading... (repeated infinitely)
ID: python/starlette-uvicorn-reload-loop
80%Fix Rate
86%Confidence
0Evidence
2024-08-30First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 0.30+ | active | — | — | — |
Root Cause
Hot reload watches a directory written to by the app itself (logs, sqlite, uploads), triggering an endless reload loop.
generic中文
热重载监视的目录被应用自身写入(日志、sqlite、上传),触发无限重载循环。
Workarounds
-
93% success
uvicorn app.main:app --reload --reload-exclude '*.log' --reload-exclude 'data/*'
-
90% success
LOG_DIR = os.environ.get('LOG_DIR', '/var/log/myapp')
Dead Ends
Common approaches that don't work:
-
70% fail
Loop resumes once the app writes again.
-
85% fail
Suppresses log output but watcher still fires.