我有一个名为app.py
的简单Bokeh应用程序如下:
### contents of app.py
from bokeh.client import push_session
from bokeh.embed import server_document
from bokeh.plotting import figure, curdoc
plot = figure()
plot.circle([1,2], [3,4])
doc = curdoc()
doc.add_root(plot)
我可以使用以下命令运行此应用程序:
bokeh serve app.py
然后我可以通过我的网络浏览器访问该图:http://localhost:5006/app.
但是,我希望我的私人网络上的所有设备都可以使用他们的网络浏览器使用该图。我该怎么做?
我发现以下命令作为建议的解决方案,但它不起作用,因为它表明我的IP地址不可用。
bokeh serve --allow-websocket-origin='ip address':'port number' my_app.py --port 'port number'
干杯!
以下命令在我的本地网络上使用Bokeh v1.0.4。首先启动IP:PORT = 192.168.1.208:5001上的Bokeh服务器。这将打开一个显示该应用的新浏览器选项卡。您可以看到远程客户端正在连接IP:POST = 192.168.1.201(另一台计算机)该图已成功显示在远程计算机的浏览器中。
bokeh serve --address 192.168.1.208 --port 5001 --allow-websocket-origin=192.168.1.201:5001 --allow-websocket-origin=192.168.1.208:5001 --show simple_app.py
2019-03-07 20:01:54,289 Starting Bokeh server version 1.0.4 (running on Tornado 4.5.3)
2019-03-07 20:01:54,294 Bokeh app running at: http://192.168.1.208:5001/simple_app
2019-03-07 20:01:54,295 Starting Bokeh server with process id: 49031
2019-03-07 20:01:54,581 200 GET /simple_app (192.168.1.208) 135.34ms
2019-03-07 20:01:54,694 101 GET /simple_app/ws?bokeh-protocol-version=1.0&bokeh-session-id=Ino2U2RYLAJ9LQXIGgNmPXnRyZNJHZQcTEEfsX0bM3f9 (192.168.1.208) 0.82ms
2019-03-07 20:01:54,694 WebSocket connection opened
2019-03-07 20:01:54,695 ServerConnection created
2019-03-07 20:02:03,208 200 GET /simple_app (192.168.1.201) 24.19ms
2019-03-07 20:02:55,503 200 GET /simple_app (192.168.1.201) 24.17ms
2019-03-07 20:02:55,617 200 GET /static/css/bokeh.min.css?v=4c253f78f16b7d5d0c9d1df8062c7f4c (192.168.1.201) 7.32ms
2019-03-07 20:02:55,618 200 GET /static/css/bokeh-widgets.min.css?v=6f280acb818327130a8c244ce05fd10d (192.168.1.201) 0.64ms
2019-03-07 20:02:55,618 200 GET /static/css/bokeh-tables.min.css?v=86c18b0b1fd30cdbc124e60cb9452e73 (192.168.1.201) 0.59ms
2019-03-07 20:02:55,743 200 GET /static/js/bokeh-widgets.min.js?v=68fceb4be2f3d6410ff2d7704c8b87cf (192.168.1.201) 1.01ms
2019-03-07 20:02:55,890 200 GET /static/js/bokeh-gl.min.js?v=70e18d8dcea09947c12764bf85ec76a0 (192.168.1.201) 1.09ms
2019-03-07 20:02:56,222 200 GET /static/js/bokeh-tables.min.js?v=02bdadb2c698bc2855a4d4a69c163821 (192.168.1.201) 478.59ms
2019-03-07 20:02:56,636 200 GET /static/js/bokeh.min.js?v=afab3eba5b3a72c05610143940e03c8e (192.168.1.201) 896.20ms
2019-03-07 20:02:58,134 404 GET /favicon.ico (192.168.1.201) 0.55ms
2019-03-07 20:02:58,149 101 GET /simple_app/ws?bokeh-protocol-version=1.0&bokeh-session-id=2CR07bJEIWPwWj07dPH3SSrou74mWgOwetucvIPuD3sk (192.168.1.201) 0.81ms
2019-03-07 20:02:58,149 WebSocket connection opened
2019-03-07 20:02:58,150 ServerConnection created