You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perhaps downloading Swagger-UI files will solve this problem.
I did like that。My API documentation worked。
ifstatic_root:
app.mount('/static', StaticFiles(directory=static_root), name='static')
else:
app.mount('/static', StaticFiles(directory=f"{root}/src/static"), name='static')
defswagger_monkey_patch(*args, **kwargs):
""" Wrap the function which is generating the HTML for the /docs endpoint and overwrite the default values for the swagger js and css. """returnget_swagger_ui_html(
*args, **kwargs,
swagger_js_url="/static/dist/swagger-ui-bundle.js",
swagger_css_url="/static/dist/swagger-ui.css")
# Actual monkey patchapplications.get_swagger_ui_html=swagger_monkey_patch
First Check
Commit to Help
Example Code
Description
Request URL: https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui.css
Request URL: https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js
Because the above two resources cannot be accessed, there is no display in the DOCS page.
Operating System
Linux
Operating System Details
No response
FastAPI Version
fastapi==0.54.1
Python Version
python 3.7.3
Additional Context
No response
The text was updated successfully, but these errors were encountered: