我想重現Metthew Rocklin blogpost的第一個例子。爲什麼正在運行的散景服務器顯示空白頁面?
有關如何運行Bokeh服務器的說明很全面,但我仍然無法使其工作。我運行下面的腳本在窗戶命令外殼「背景虛化的服務big_bokeh_test.py --show」:
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler
from bokeh.plotting import figure, ColumnDataSource
def make_document(doc):
fig = figure(title='Line plot!', sizing_mode='scale_width')
fig.line(x=[1, 2, 3], y=[1, 4, 9])
doc.title = "Hello, world!"
doc.add_root(fig)
apps = {'/': Application(FunctionHandler(make_document))}
server = Server(apps, port=5000)
server.start()
沒有錯誤,服務器在運行,只是輸出是一個空的頁面。我已經尋找解決方案。下面的鏈接可能相關,但並沒有解決我的問題:
How to get a Bokeh Server to display a DataTable
Bokeh Server not displaying plots
bokeh serve running but can't access with browser
我使用Python 3.6.3(64位)和背景虛化0.12.9。這裏是從Windows外殼程序的輸出:
PS C:\Users\kateryna.smirnova\Documents\IBB\bokeh_graphs> bokeh serve big_bokeh_test.py --show
2017-10-14 10:48:00,231 Starting Bokeh server version 0.12.9 (running on Tornado 4.5.2)
2017-10-14 10:48:00,235 Bokeh app running at: http://localhost:5006/big_bokeh_test
2017-10-14 10:48:00,235 Starting Bokeh server with process id: 564
2017-10-14 10:48:00,445 Starting Bokeh server version 0.12.9 (running on Tornado 4.5.2)
2017-10-14 10:48:00,469 200 GET /big_bokeh_test (::1) 137.37ms
2017-10-14 10:48:00,785 101 GET /big_bokeh_test/ws?bokeh-protocol-version=1.0&bokeh-session-id=ERMj5xsMHtF7o3P6KxRRrPDfIMAvIhMcNffgxuct4950 (::1) 1.03ms
2017-10-14 10:48:00,786 WebSocket connection opened
2017-10-14 10:48:00,788 ServerConnection created
我正在使用帶有add_root的curdoc,這對我來說效果很好。謝謝bigreddot。 – kateryna