set root-path to uvicorn
See original GitHub issueI’m trying to set root_path to uvicorn as suggested [1] using this image, but don’t see any options to pass arguments:
uvicorn main:app --root-path /api/v1
How can I do it?
Refs:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Settings - Uvicorn
Use the following options to configure Uvicorn, when running from the ... --root-path <str> - Set the ASGI root_path for applications submounted below...
Read more >fastapi dynamic root path - uvicorn - Stack Overflow
Wondering, if we can set the root path in a dynamic way in places like middleware where we can use x-forwarded header to...
Read more >Behind a Proxy - FastAPI
In these cases you can use root_path to configure your application. ... And now start your app with Uvicorn, using the --root-path option:....
Read more >Developers - set root-path to uvicorn - - Bountysource
I'm trying to set root_path to uvicorn as suggested [1] using this image, but don't see any options to pass arguments:
Read more >tiangolo/fastapi - Gitter
... FastAPI applications to provide it in cases where it can be set with the command line (e.g. for Uvicorn and Hypercorn, with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@poppash On my side it does not work I am getting an error in OpenApi
Python 3.7.8 fastapi 0.63.0
Run configuration: uvicorn.run(“app:app”, host=“0.0.0.0”, port=port, reload=True)
I think the error is in the path here is console log:
127.0.0.1:54913 - "GET /api/v1/api/v1/openapi.json HTTP/1.1" 404 Not FoundHere is double path: /api/v1/api/v1/I struggled with this as well. Got it working in the end, albeit by setting
root_pathvia the FastAPI object, e.g.,app = FastAPI(root_path='/api/v1')and upgrading FastAPI.Before upgrading it didn’t work either using the current
tiangolo/uvicorn-gunicorn-fastapi-docker:python3.8image because it still hasfastapi==0.55.1installed. Trydocker container run tiangolo/uvicorn-gunicorn-fastapi:python3.8 pip freeze | grep fastapito verify. This image was last updated 3 months ago, probably just before the release offastapi==0.56.0(see PR).Extending from
tiangolo/uvicorn-gunicorn-fastapi-docker:python3.8and thenpip install --upgrade fastapi==0.61.1did the trick for me.@tiangolo will the images be updated in the near future?