How to embed an app/document with a custom template?

Hi all,

This is possibly a trivial question, but I’m new to Bokeh and I have essentially no experience with html or javascript.

I run bokeh directory application (https://github.com/bokeh/bokeh/tree/master/examples/app/dash) and it works perfectly well with new template feature(dash_template.png).

bokeh serve --show --allow-websocket-origin=localhost:8080 --allow-websocket-origin=localhost:5006 dash

After that I want to embed this application into flask using server_session (https://bokeh.pydata.org/en/1.0.2/docs/user_guide/embed.html#bokeh-applications) (server_session_embed.png):

serve.py

from flask import Flask, render_template

from bokeh.client import pull_session

from bokeh.embed import server_session

app = Flask(name)

@app.route(’/’, methods=[‘GET’])

def bkapp_page():

pull a new session from a running Bokeh server

with pull_session(url=“http://localhost:5006/dash”) as session:

generate a script to load the customized session

script = server_session(session_id=session.id, url=‘http://localhost:5006/dash’)

use the script in the rendered page

return render_template(“embed.html”, script=script, template=“Flask”)

if name == ‘main’:

app.run(port=8080)

embed.html

<!doctype html>

{{ script|safe }}

Change session.template in pull_session don’t help too.

Is it possible to render script from server_session with new template feature (https://bokeh.pydata.org/en/1.0.2/docs/user_guide/embed.html#standard-template)?

Thanks,

Mikhail.