You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (config.reloadorconfig.workers>1) andnotisinstance(app, str):
logger=logging.getLogger("uvicorn.error")
logger.warning("You must pass the application as an import string to enable 'reload' or ""'workers'.")
sys.exit(1)
IIUC, this was done because it is impossible to reload (or load multiple times when using multiple workers) an instance. However, this should not be a limitation if an app factory supplied. Now the factory can be called again for each reload. Loading from a string or from a factory is done back to back already:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When using
uvicorn.run
from Python withreload=True
set, one immediately hitsuvicorn/uvicorn/main.py
Lines 564 to 567 in 44a3071
IIUC, this was done because it is impossible to reload (or load multiple times when using multiple workers) an instance. However, this should not be a limitation if an app factory supplied. Now the factory can be called again for each reload. Loading from a string or from a factory is done back to back already:
uvicorn/uvicorn/config.py
Lines 433 to 449 in 44a3071
Beta Was this translation helpful? Give feedback.
All reactions