Problem Using Templates with Django

Hi,

I am trying to use a template to style my panel app running on django app but I’m running into some issues. The panels I add to my template show up fine but none of the variables or custom html are rendered. To make the issue easier to replicate, I modified the example django2 project based directly off the template documentation. In the screenshot below I would expect to see the text included in my <p> tag and in the app_title variable. Am I implementing this wrong?

sliders/pn_app.py:

import panel as pn

from .sinewave import SineWave

template = """
{% extends base %}

<!-- goes in body -->
{% block postamble %}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
{% endblock %}

<!-- goes in body -->
{% block contents %}
{{ app_title }}
<p>This is a Panel app with a custom template allowing us to compose multiple Panel objects into a single HTML document.</p>
<br>
<div class="container">
  <div class="row">
    <div class="col-sm">
      {{ embed(roots.A) }}
    </div>
    <div class="col-sm">
      {{ embed(roots.B) }}
    </div>
  </div>
</div>
{% endblock %}
"""

def app(doc):
    sw = SineWave()

    tmpl = pn.Template(template)

    tmpl.add_variable('app_title', '<h1>Custom Template App</h1>')

    tmpl.add_panel('A', sw.param)
    tmpl.add_panel('B', sw.plot)
    tmpl.server_doc(doc)

I am running panel 0.9.5, bokeh 2.0.0, and holoviews 1.13.2

Thanks,
Sebastian

Do you get any errors in the browser’s console?

@Jhsmit
No errors besides devtools stuff

I’ll have to investigate this more deeply, I’m not yet sure how templating interacts with the Django integration. This may end up needing fixes in bokeh itself.

Thanks for looking into it. Let me know if you need any more info about my setup or if I can help in any way.