I'm trying to run a code that is a combination of flask
and bokeh
, however, I get the following error:
KeyError: "View model name 'panel.models.tabulator.DataTabulator' not found"
The code snippet:
from bokeh.client import pull_session
from bokeh.embed import server_session
from flask import Flask, render_template, request, redirect, url_for
...
@app.route('/', methods=['GET'])
@cross_origin()
def getup():
filenames = os.listdir(app.config['UPLOAD_FOLDER'])
filename = None
args = {'filename':filename} if filename else None
with pull_session(url="http://127.0.0.1:5006/bokeh/server", arguments=args) as session: # Error is in this line
# generate a script to load the customized session
script = server_session(session_id=session.id,
url="http://127.0.0.1:5006/bokeh/server")
# use the script in the rendered page
return render_template("index.html", script=script, template="Flask",
filenames=filenames, selected_fn=filename)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000, debug=True)
Also, bokeh
is running by the following command:
bokeh serve src/server --allow-websocket-origin="127.0.0.1:5000" --allow-websocket-origin=\* --prefix=bokeh