Use favicon

This commit is contained in:
Andras Schmelczer 2022-07-09 20:52:29 +02:00
parent 378047e622
commit bf7982c56b
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
4 changed files with 20 additions and 8 deletions

View file

@ -7,7 +7,11 @@ from starlette.responses import HTMLResponse
def bootstrap_docs_endpoints(app: FastAPI) -> None:
@app.get("/docs", include_in_schema=False)
def custom_swagger_ui_html() -> HTMLResponse:
return get_swagger_ui_html(openapi_url="openapi.json", title=app.title)
return get_swagger_ui_html(
openapi_url="openapi.json",
title=app.title,
swagger_favicon_url="/favicon.ico",
)
@app.get("/docs/index.html", include_in_schema=False)
def redirect_to_docs() -> RedirectResponse: