simple-ai icon indicating copy to clipboard operation
simple-ai copied to clipboard

[Wiki] Setting favicon with FastAPI

Open 1chooo opened this issue 2 years ago • 0 comments

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',
    )

1chooo avatar Sep 27 '23 11:09 1chooo