解决FastAPI项目swaggerUI打不开的问题
## 正常的实例化API操作
from fastapi import FastAPI
app = FastAPI()
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi import FastAPI, applications
def swagger_monkey_patch(*args, **kwargs):
return get_swagger_ui_html(
*args, **kwargs,
swagger_js_url='https://cdn.bootcdn.net/ajax/libs/swagger-ui/4.10.3/swagger-ui-bundle.js',
swagger_css_url='https://cdn.bootcdn.net/ajax/libs/swagger-ui/4.10.3/swagger-ui.css'
)
applications.get_swagger_ui_html = swagger_monkey_patch