flask bokeh server- figure 不渲染(ubuntu)但在本地机器上工作
flask bokeh server- figure does not render (ubuntu) but works on local machine
我创建了一个可通过 Flask 访问的散景图。我能够通过
在我本地机器上通过烧瓶成功运行散景服务器
散景服务器bokeh serve--allow-websocket-origin=localhost:5000 filename.py
flask python run.py
两个命令 windows
现在我想在虚拟机 运行ning ubuntu 上做同样的事情。在两个 putty windows 上使用完全相同的命令不再有效。不过,我可以访问非散景 html 页面。
尝试访问散景图时,我得到:
OSError: Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)
但我已经开始了 bokeh serve
这是 flask 中将调用 bokeh 服务器的代码片段
@main.route("/grid")
def bokehserver():
session=pull_session(url="http://localhost:5006/filename")
bokeh_script=autoload_server(None, url="http://localhost:5006/filename",session_id=session.id)
return render_template("bokserv.html",bokeh_script=bokeh_script)
编辑:我正在 linux 上阅读有关 运行 宁散景服务器的 'linux server configuration files' 的内容。我没有制作这样的配置文件。有人可以确认这些是否完全必要吗?我不想让我的项目过多。在我见过的许多示例中,开发人员使用 nginx 和 gunicorn 以及其他东西来获得 flask/bokeh 和 运行ning,但到目前为止我已经能够避免这些额外的层..
edit2: ubuntu 终端中的 bokeh serve --show filename.py
生成标准消息,就好像它在工作一样,但它不会打开浏览器来显示图形。
我创建了初始 post 中引用的配置文件并使用了 bokeh serve --allow-websocket-origin=(my ip):5000 filename.py
。
然后在flask文件中from werkzeug.contrib.fixers import ProxyFix
然后在 app.route(/)
之外我放了 app.wsgi_app=ProxyFix(app.wsgi_app)
然后我导航到 (my ip):5000
成功了。
我创建了一个可通过 Flask 访问的散景图。我能够通过
在我本地机器上通过烧瓶成功运行散景服务器散景服务器bokeh serve--allow-websocket-origin=localhost:5000 filename.py
flask python run.py
两个命令 windows
现在我想在虚拟机 运行ning ubuntu 上做同样的事情。在两个 putty windows 上使用完全相同的命令不再有效。不过,我可以访问非散景 html 页面。
尝试访问散景图时,我得到:
OSError: Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)
但我已经开始了 bokeh serve
这是 flask 中将调用 bokeh 服务器的代码片段
@main.route("/grid")
def bokehserver():
session=pull_session(url="http://localhost:5006/filename")
bokeh_script=autoload_server(None, url="http://localhost:5006/filename",session_id=session.id)
return render_template("bokserv.html",bokeh_script=bokeh_script)
编辑:我正在 linux 上阅读有关 运行 宁散景服务器的 'linux server configuration files' 的内容。我没有制作这样的配置文件。有人可以确认这些是否完全必要吗?我不想让我的项目过多。在我见过的许多示例中,开发人员使用 nginx 和 gunicorn 以及其他东西来获得 flask/bokeh 和 运行ning,但到目前为止我已经能够避免这些额外的层..
edit2: ubuntu 终端中的 bokeh serve --show filename.py
生成标准消息,就好像它在工作一样,但它不会打开浏览器来显示图形。
我创建了初始 post 中引用的配置文件并使用了 bokeh serve --allow-websocket-origin=(my ip):5000 filename.py
。
然后在flask文件中from werkzeug.contrib.fixers import ProxyFix
然后在 app.route(/)
之外我放了 app.wsgi_app=ProxyFix(app.wsgi_app)
然后我导航到 (my ip):5000
成功了。