Jinja2 variables in bokeh

对着背影说爱祢 提交于 2019-12-12 22:33:59

问题


I'm trying to pass some variable to a bokeh document which renders a Jinja template.

The code is:

curdoc().template = template
curdoc().template_variables["testvar"] = "cia"
curdoc().add_root(row(p1,p2))

If I don't use variables at all in the template and don't try to access them via template_variables all works fine, but with the code above I get the error:

curdoc().template_variables["testvar"] = "cia"
AttributeError: 'Document' object has no attribute 'template_variables'

The command I use to start the application of course is:

bokeh serve  --show myapp

Where do I do wrong?

Thanks, gian


回答1:


template_variables is a relatively new feature added in 0.12.4. You need to upgrade to a newer Bokeh version than whatever you have currently installed.



来源:https://stackoverflow.com/questions/41896337/jinja2-variables-in-bokeh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!