Reload only working when app is supplied as string #2553
Unanswered
soslan
asked this question in
Potential Issue
Replies: 1 comment
-
If the string is provided, uvicorn will try to import it. If it's the app itself, it will try to use it, but reload runs on another process. I think... If you can make a way to pass the app location as string to the reloader, then it would work. But it's expected as of today. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I am tinkering with programmatic start of uvicorn server, and encountered this unexpected behavior. When I supply an
ASGIApplication
toConfig()
, reload functionality is not working becauseshould_reload
checks whetherself.app
is a string and returnsFalse
:uvicorn/uvicorn/config.py
Lines 528 to 530 in 90f4369
Instead of working reload functionality, I see this:
uvicorn/uvicorn/config.py
Lines 281 to 284 in 90f4369
But there is nothing in the docs that mentions what conditions are required for the reload to work.
Is this a bug or reload only works with str-defined app for a reason? If it is a bug, I am willing to contribute by fixing it.
Beta Was this translation helpful? Give feedback.
All reactions