`uvicorn.run("<module>:<app variable>"...
# general
m
uvicorn.run("<module>:<app variable>", reload=True)
f
Dependency is not resolved when trying this ie if I try
Copy code
from project1.main import app

uvicorn.run(app)
it will resolve dependencies and work But
Copy code
uvicorn.run("project1.main:app")
will fail with "Cannot Import project1.main"
m
you need to add
project1
to the
dependencies=
on the BUILD file
but it seems using
--loop
on pants is the way to go here
reload in code doesn't work on uvicorn if the first argument is not a string
f
you need to add
project1
to the
dependencies=
on the BUILD file
ya i tried that right now, uvicorn reload doesn't work even if its set to
True
, I guess, because pants run on a sandbox, what I'm changing locally doesn't affect the sandbox. But uvicorn does detect changes in my file and reloads itself, never gets reflected though.
👍 1