Python Bokeh 0.12.4到0.12.5--Twisted服务器代理到Bokeh服务器失败
我使用TwistedPython服务器托管一个概述页面,该页面链接到bokeh服务器上运行的应用程序。twisted服务器将传入请求(类似于Python Bokeh 0.12.4到0.12.5--Twisted服务器代理到Bokeh服务器失败,python,websocket,twisted,bokeh,Python,Websocket,Twisted,Bokeh,我使用TwistedPython服务器托管一个概述页面,该页面链接到bokeh服务器上运行的应用程序。twisted服务器将传入请求(类似于:80)代理到bokeh服务器(在端口5006) 我决定使用twisted服务器,因为我希望能够使用anaconda python运行整个系统。对于bokeh 0.12.4,该解决方案运行良好 我希望下面的例子能够说明我的服务器设置在bokeh版本0.12.5上的问题。目前我怀疑WebSocket和twisted服务器出了问题,但由于我对WebSocket缺
:80
)代理到bokeh服务器(在端口5006
)
我决定使用twisted服务器,因为我希望能够使用anaconda python运行整个系统。对于bokeh 0.12.4,该解决方案运行良好
我希望下面的例子能够说明我的服务器设置在bokeh版本0.12.5上的问题。目前我怀疑WebSocket和twisted服务器出了问题,但由于我对WebSocket缺乏经验,我不知道从哪里开始
小例子
Bokeh应用程序
bokeh服务器从localhost:5006
上托管sliders应用程序
- 保存在滑块/main.py中
- 使用
(我通过反复试验基本上想出了bokeh serve滑块运行--端口5006--主机本地主机:5006--允许websocket原点=127.0.0.1:8080
和--主机
的组合;这在bokeh 0.12.4下工作)--允许websocket原点
- (只需在没有服务器的情况下运行应用程序,效果就非常好
bokeh-service-show-Sliders
127.0.0.1:8080
上托管一个网站,并带有指向127.0.0.1:8080/apps/Sliders
的链接。如果用户调用此链接,服务器将在localhost:5006\Sliders
上代理bokeh服务器应用程序
- 使用python twisted_server.py运行
这可能是以下内容的副本:
在这种情况下,您需要从最近发布的Tornado 4.5降级或升级到更新的Bokeh版本,该版本已修复了不兼容问题。我尝试了@bigreddot提到的方法,但不幸的是,这没有帮助。我只是尝试了这种方法,但没有成功。仍然存在相同的错误。
from twisted.internet import reactor
from twisted.web import proxy, server
from twisted.web.static import File
resource = File('./www/')
resource.putChild('apps',proxy.ReverseProxyResource('localhost', 5006, ''))
site = server.Site(resource)
reactor.listenTCP(8080, site)
reactor.run()
<!DOCTYPE html>
<html lang="de">
<head>
<title>Sliders</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>
<a target="_blank" href="apps/Sliders">Sliders</a>
C:\Users\Benjamin\Anaconda2\lib\site-packages\bokeh\command\subcommands\serve.py:325: UserWarning: The --host parameter is deprecated because it is no longer needed. It will be removed and trigger an error in a future release. Values set now will be copied to --allow-websocket-origin. Depending on your use case, you may need to set current --host values for 'allow_websocket_origin' instead.
"The --host parameter is deprecated because it is no longer needed. "
2017-04-20 12:18:00,375 Starting Bokeh server version 0.12.5
2017-04-20 12:18:00,454 Starting Bokeh server on port 5006 with applications at paths ['/Sliders']
2017-04-20 12:18:00,454 Starting Bokeh server with process id: 2308
2017-04-20 12:18:25,055 200 GET /Sliders (127.0.0.1) 543.00ms
2017-04-20 12:18:25,915 400 GET /Sliders/ws?bokeh-protocol-version=1.0&bokeh-session-id=FICIeGnPQLGK7363ORLcpTPMVBCiPffpOgGx2qdy5AdM (127.0.0.1) 0.00ms