simple-ai
simple-ai copied to clipboard
[Wiki] Setting favicon with FastAPI
PROJECT_ROOT
├── static/
│ ├── favicon.ico
├── Refinaid/
│ ├── App/
│ │ ├── app.py
│ :
└── :
In the below of our project structure, if we want to set a favicon for all pages we can add the below code in Refinaid.App.app and remember to add include_in_schema=False included in the decorator hides the path operation from the schema used to autogenerate API docs.
@app.get('/favicon.ico', include_in_schema=False)
async def favicon() -> FileResponse:
return FileResponse(
'./static/favicon_path',
)