Embedding bokeh plot and datatable in flask
The way I like to do this is to use the full power of the embed.components
method and pass in a dictionary of plot objects and then render them wherever I need in my html template.
I call components as follows:
from bokeh.embed import componentsscript, div_dict = components({"plot": plot, "table": table})
My div_dict
looks like this:
# {"plot": plot_div, "table": table_div})
I then pass this dict and the script into my template context and use it something like this:
<body> {{ plot_div }} {{ table_div }} {{ script }}</body>
Here's an example from the bokeh examples: https://github.com/bokeh/bokeh/blob/master/examples/embed/embed_multiple_responsive.py#L26