Using Bokeh 0.12.4 and django 1.10.6, how can I get a scriptfor an individual figureusing autoload_server.
In myapp/main.py:
from bokeh.plotting import Figure
from bokeh.io import curdoc
fig1= Figure(plot_width=500, plot_height=300, name='fig1')
fig2 = Figure(plot_width=500, plot_height=300, name='fig2')
curdoc().add_root(fig1)
curdoc().add_root(fig2)
In mysite/views.pyI would like to do something like this:
from django.shortcuts import render
from bokeh.embed import autoload_server
def index(request):
script1 = autoload_server(model='fig1', url="http://localhost:5006/myapp")
script2 = autoload_server(model='fig2', url="http://localhost:5006/myapp")
return render(request, 'index.html', context={'script1': script1, 'script2': script2})
And then put the scripts where I want in the html template mysite/templates/index.html:
<div>
{{script1 | safe }}
</div>
<div>
{{script2 | safe }}
</div>
source
share