How to favicon in bokeh app

I have been trying to add favicon on the bokeh app using the following code, but it gives a 404 upon GET of the given URL

        <link rel="shortcut icon" type="image/png" href="/covid19-india/favicon.ico"/>

I have also tried placing the favicon to static folder and updating the path and yet it fails to GET the favicon.

Is there any other way Bokeh works with favicon as it does with title?

What is the file tree of your application?
It has to have the static directory at the root and have the main.py there as well: Running a Bokeh server — Bokeh 2.4.2 Documentation

I have updated filetree as follows using the before mentioned html/css with updated href path and I still get an error:

covid19-india
--static
        ----favicon.ico
--templates
--main.py

Does it work if you use href="/favicon.ico" instead?

The shared file structure does show the ico file when I go to the URL : localhost:5006/covid19-india/static/favicon.ico but it fails to GET the file though for the favicon.

My bad. In the staging, the href had the root url too. I updated it with the path name alone and it worked.

Thanks for the solution.

FWIW we have considered adding “built in” favicon support:

But that discussion quickly went of on some tangents. I wonder if if wouldn’t be better just to demonstrate how to accomplish things with a directory app. @akashagl92 if you are interested and have time, you could add a favicon to any of the “directory” app examples in the repo:

1 Like