bokeh

Where should I put `favicon.ico` so bokeh serve can find and render it?


I have a directory format app, named myapp like:

myapp/
   |
   + -- main.py
   + -- favicon.ico
   + -- static
           |
           + -- some.img

If I run bokeh serve myapp, I keeps getting 404 GET /favicon.ico (::1).

Where should I put favicon.ico?


Solution

  • Create folder "templates" and add "index.html" with

    {% extends base %}
    
    {% block preamble %}
    <link rel="icon" type="image/x-icon" href="myapp/static/favicon.ico">
    {% endblock %}
    

    And move your "favicon.ico" in the folder "static". So you have:

    myapp/
       |
       + -- main.py
       + -- templates
               |
               + -- index.html
       + -- static
               |
               + -- favicon.ico
    

    Here are some more information about extending the bokeh template. https://docs.bokeh.org/en/latest/docs/user_guide/output/embed.html#standard-template

    Also kudos to the answer from bigreddot and the helpful comment by gepcel.