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
?
You can add an HTML template to a Bokeh application, under the templates
directory. With that, you can specify an favicon location in the normal way in the <head>
of your template. For an example of an app that uses a template, see the crossfilter demo in the GitHub repo.
The template just needs to have
{{ plot_div }}
{{ plot_script }}
in the <body>
. The app is rendered wherever the plot_div
is located.
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/embed.html#standard-template
Also kudos to the answer from bigreddot and the helpful comment by gepcel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With