Bokeh server (jinja2) template change variable value

I have a small bokeh server app (for tracking corona).
In the template there is a variable that I pass from python (cur_ratio, which is the size difference between countries).

The ratio is passed once on the initial rendering. But I didn’t find a way to update it dynamically when user changes the countries.

The code is here:

index.html:

                <p>population ratio is: {{ cur_ratio }} </p>

main.py:
curdoc().template_variables[“cur_ratio”] = round(cur_ratio,1)

But it doesn’t update.

Any idea how can I do that?

I solved it with a “Div” widget markup:
https://docs.bokeh.org/en/latest/docs/reference/models/widgets.markups.html:

1 Like