I have a flask app that serves bokeh server documents:
def route...
return render_template(
'base.html',
script=server_document(url=url, arguments=kwargs))
I adopted panel early on before it had templates, that we knew of, and now I’d like to be able to serve templated panel dashboards too.
I’m able to get the template to display correctly within a jupyter notebook, (we usually serve the bokeh apps with panel serve
), but when it’s embedded in the Flask app it doesn’t serve correctly.
I think I traced the problem to {% from macros import embed %}
. That line was missing from my base.html. You can see it’s included in the typical templating from panel: Panel Templates User Guide
So I added it but that seemed to lead to errors:
jinja2.exceptions.UndefinedError: 'macros' is undefined
and
UndefinedError: 'embed' is undefined
I thought it was a jinja2 thing so I made sure I had an updated version, but that didn’t help. Is macros
coming from an IPython module of some kind?
Perhaps I’m actually getting ahead of myself. I may not want to embed
the components at all, from my understanding that can take a while if you have a lot of data. And we’re already set up to talk directly to a bokeh server.
I guess all I really want is the panel Templating functionality, plus or minus the embed. Perhaps there’s a simpler solution to achieving templating directly in our jupyter notebooks.
Any advice is greatly appreciated!