python - Embedding a bokeh app in flask -


i trying desperately embed working bokeh applet flask, , can't find proper way this. looked through examples, can't find 1 includes ability update data (best example: sliders_applet).

if i'm not mistaken, need bokeh-server able change data (with sliders etc.). starting applet way works, e.g.:

bokeh-server --script sliders_app.py 

but can't find proper, or @ least working way embed sliders_app flask. , since should possible use multiple applets, doesn't seem clean me specify 1 single applet @ startup of bokeh server too..

i gladly appreciate - bokeh looks great tool me.

the other answer not describe how embed bokeh server app (it uses components embed standalone bokeh document).

first, can see lots of live examples hosted at: https://demo.bokehplots.com/

for embedding apps there 2 usual options:

the latter used this:

script = autoload_server(model=none,                          app_path="/apps/slider",                          url="https://demo.bokehplots.com") 

this return <script> tag similar 1 below, can put in flask html response, wherever you'd app appear:

<script     src="https://demo.bokehplots.com/apps/slider/autoload.js?bokeh-autoload-element=c5c9bdb5-40e8-46a2-9bf0-40a9d396ce97"     id="c5c9bdb5-40e8-46a2-9bf0-40a9d396ce97"     data-bokeh-model-id=""     data-bokeh-doc-id="" ></script> 

lastly, it's important note default bokeh server opts conservative network configuration. you'll need start bokeh server --allow-websocket-origin command line option set whatever host embedding bokeh app into.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -