按照复杂度的顺序,使用金字塔,我可以创建静态bokeh图,然后用div标记(如outlinedhere)对其进行编码。在
Bokeh documentations清楚地解释了如何为交互式数据探索设置bokeh服务器,我已经成功地创建了这样一个应用程序。在
但我想做的是在金字塔视图页面中有一个交互式图形。本页要求如下:
有些事情我不清楚:
有一个one paragraph提到了如何将bokeh服务器嵌入到Flask或Tornado应用程序中。但这段话太简短了,我现在不太明白。所以我问我在金字塔里怎么做?在
嵌入另一个(烧瓶、django、tornado等)过程的运行公式在所有情况下基本相同。在这个“独立”的示例中介绍了一些基本要素,其中仅显示了在您自己管理的Tornado
IOloop
上启动Bokeh服务器所需的步骤:https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/standalone_embed.py
基本步骤包括:
生成Bokeh文档的函数:
使用此函数创建一个Bokeh
^{2美元Application
,并用它启动Bokeh服务器:最后,将Bokeh
Server
添加到您创建和管理的龙卷风IOloop
中:然后你的(Flask,Django,Pyramid,随便什么)视图都可以使用}以标准方式从该服务器嵌入Bokeh应用程序(示例见Flask嵌入脚本)
<iframes>
或{正如bigreddot所说,工作流程与代码中微小的更改非常相似。我实际上是根据他的回答来回答的。谢谢你,比格瑞多!在
以下是我的解决方案,集成博克服务器和金字塔。在
- 将应用程序的路由位置添加到金字塔服务器配置对象。
主要在
^{pr2}$__init__.py
或配置路由的任何其他文件中。在bokeh_app
的视图。此函数可以用views.py
编写,也可以在您认为合适的地方编写。在allow_websocket_origin
接受必须升级以支持bokeh所需的web套接字连接的字符串列表。在这种情况下,我们需要给出金字塔服务器的url相关问题 更多 >
编程相关推荐