Documentation Failed to fetch /openapi.json #7395
Unanswered
NastasiaSaby
asked this question in
Questions
Replies: 4 comments 1 reply
-
I found a solution. I launched fastapi with a "root-path" like this:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for reporting back and closing the issue 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
-
fyi: it is also possible to pass the root_path as a parameter while creating a FastAPI instance (as described here):
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Thank you, Sir Benedick! My career as a student has taken me away from
Fast API for the moment, but should I return (and I'm intrigued by the
whole process) I'll refer back to this. Have a great day.
Josh
…On Thu, Aug 4, 2022 at 5:14 AM SirBenedick ***@***.***> wrote:
I found a solution. I launched fastapi with a "root-path" like this:
uvicorn fast_api.server:app --host 0.0.0.0 --port 8000 --root-path="/suburl"
fyi: it is also possible to pass the root_path as a parameter while
creating a FastAPI instance (as described here
<https://fastapi.tiangolo.com/advanced/behind-a-proxy/?h=root+path#setting-the-root_path-in-the-fastapi-app>
):
from fastapi import FastAPI, Request
app = FastAPI(root_path="/api/v1")
@app.get("/app")
def read_main(request: Request):
return {"message": "Hello World", "root_path": request.scope.get("root_path")}
—
Reply to this email directly, view it on GitHub
<#1811 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALD4BVW7Z4MDMNDQ73IOPU3VXOJXTANCNFSM4PLXLXQA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
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
-
When I click https://host/suburl/documentation
I have a "Failed to load definition".
In the console, I have
My code looks like that:
Beta Was this translation helpful? Give feedback.
All reactions