Reload only working when app is supplied as string #2553
Unanswered
soslan
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
|
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.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I am tinkering with programmatic start of uvicorn server, and encountered this unexpected behavior. When I supply an
ASGIApplicationtoConfig(), reload functionality is not working becauseshould_reloadchecks whetherself.appis a string and returnsFalse:https://github.com/encode/uvicorn/blob/90f43699c79bcd2b0676186fc6d3b9baf679d3c8/uvicorn/config.py#L528-L530
Instead of working reload functionality, I see this:
https://github.com/encode/uvicorn/blob/90f43699c79bcd2b0676186fc6d3b9baf679d3c8/uvicorn/config.py#L281-L284
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