Search code examples
python-3.xbokehtornado

Bokeh serve returns white page


I try to serve a bokeh app via bokeh serve myapp.py and the app is running at: http://localhost:5006/myapp. However, the browser shows a blank white page.

Trying to solve the issue I found the suggestion to set the environmental variable BOKEH_RESOURCES=inline. It doesn't change anything.

If I simply run the Python file then the returned webpage has the same address as the server app, but it is actually showing content and is responsive. Looking at the source code of the page I can see that there is a reference to https://cdn.pydata.org/bokeh/release/bokeh-1.4.0.min.js and the body contains data in the application/json script.

The server app does not contain data in the application/json script and references to Bokeh are like this:

<script type="text/javascript" src="static/js/bokeh.min.js?v=ac90935137e13ae0b2c6583f2e1f3fe8"></script>

I can also see the title of the page is Bokeh Application while it should have the title set in myapp.py

My environment:

  • centOS 7
  • Bokeh 1.4.0
  • Tornado 6.0.3

Solution

  • After the suggestion by @bigreddot I added the following code snippets to my script and called it through bokeh serve myapp.py.

    from bokeh.plotting import figure, curdoc
    from bokeh.layouts import column
    from bokeh.client import push_session
    
    curdoc().add_root(column(p))
    session = push_session(curdoc())
    session.show()