Hi there,
I’ve been exploring with Bokeh for the last several days. I have tried a lot of your examples and also been able to create some plots myself. I also had success in Deploying Bokeh Apps at Heroku. Bokeh really rocks!
Now I’m trying to embed Bokeh app using the Flask frame work.
- Was able to embed static Bokeh (script and div) into Flask framework and deploy it to Heroku
- Was able to embed Bokeh Server app into Flask locally in my machine, but I’m stuck with deploying in Heroku.
I’m able to see at my browser the tag generated by the server_document function, but right now Chrome is fighting with http and https mixed content. I don’t know if the Bokeh server is running at Heroku (any way I can configure logging to be re-routed from the Bokeh server to the main server?)
Does anyone has a minimal working example in Github?
Thank you in advance.
This code snippet is from the bokeh-master/examples/howto/embed/server_embed/flask_gunicorn_embed.py
# This is so that if this app is run using something like "gunicorn -w 4" then
# each process will listen on its own port
sockets, port = bind_sockets("localhost", 0)
@app.route('/', methods=['GET'])
def bkapp_page():
script = server_document('http://localhost:%d/bkapp' % port)
return render_template("embed.html", script=script, template="Flask")
def bk_worker():
asyncio.set_event_loop(asyncio.new_event_loop())
bokeh_tornado = BokehTornado({'/bkapp': bkapp}, extra_websocket_origins=["localhost:8000"])
bokeh_http = HTTPServer(bokeh_tornado)
bokeh_http.add_sockets(sockets)
server = BaseServer(IOLoop.current(), bokeh_tornado, bokeh_http)
server.start()
server.io_loop.start()


