☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Render Bokeh Plot in Html template Without using Flask

Community Support
srikanth_jaladi
srikanth_jaladi

Hi Team,
I am trying to embed a bokeh plot into html. But i am not able to render. Hers is my code.

main.py

from bokeh.plotting import figure
from bokeh.io import curdoc
from bokeh.layouts import row
p = figure(title='One sample graph',
            plot_width=700,
            plot_height=700,
            toolbar_location=None)

p.circle([1,2,3,4,5],[6,7,2,5,4], size=15)

curdoc().add_root(row(p, name='plotrow'))

index.html

{% extends base %}
{% block preamble %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans" rel="stylesheet">
<link rel="stylesheet" href="app/static/special.css">
{% endblock %}
{% block contents %}
<title>Dashboard</title>
<div class="background">
<div class="header">
<h1>Text</h1>
<h2>Some more text</h2>
<p>Even more text</p>
</div>
<div class="bar"></div>
<div class="container">{{ embed(roots.plotrow) }}</div>
<div class="footer">
<p>Some extra text <br/>By someone</p>
</div>
</div>
{% endblock %}

I tried to run my bokeh using the following command(doing this on aws ubuntu vm). Plot is rendering but not embed into html template.

CMD: bokeh serve main.py --show

this is my plot. please have a look.

Please help me on this.

Thanks.

⌁   Link to post
Bryan
Bryan

In order to make use of all the extra features of Directory Format apps (e.g. automatically loading a template file) you need to invoke bokeh serve on the directory containing main.py not on main.py itself. The docs have a complete description of the expected layout.

⌁   Link to post
Bryan
Bryan

I just noticed this was cross-country posted to stack overflow. Please make sure that there are cross links in both posts so that an answer in one place ensures an answer is accessible anywhere.

⌁   Link to post

End of archived discussion · Replies are disabled