-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google "How to X in FastAPI" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to FastAPI but to Pydantic.
- I already checked if it is not related to FastAPI but to Swagger UI.
- I already checked if it is not related to FastAPI but to ReDoc.
Commit to Help
- I commit to help with one of those options 👆
Example Code
https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui.css
https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui-bundle.jsDescription
Two years later, I still have trouble loading 'Swagger' resources. First step, I looked up the article about 'FastAPI' and 'Swagger' not loading. Some friends suggest using 'CSS' and 'JavaScript' files stored in the 'static' folder of your project, And modify the Python 'Lib/site-package/fastapi/openapi/docs.py' the 'url' for the relative path. However, I don't think it's a good idea to modify your own source code.
Operating System
Windows
Operating System Details
Windows11(22H2.25120.1010)
FastAPI Version
0.78.0
Python Version
3.10.0
Additional Context
So, when I looked through the official use case of 'Swagger', I realized that it might have something to do with 'CDN'. Therefore, it is recommended to use a modified CDN. Thank you very much!
CSS Link https://unpkg.com/swagger-ui-dist@4/swagger-ui.css
JavaScript Link https://unpkg.com/swagger-ui-dist@4/swagger-ui-bundle.js