简体   繁体   English

flask bokeh bokeh服务器-图不渲染(ubuntu),但在本地计算机上工作

[英]flask bokeh server- figure does not render (ubuntu) but works on local machine

I've created a bokeh plot that is accessible through Flask. 我创建了一个可以通过Flask访问的散景图。 I am able to successfully run bokeh server through flask on my local machine via 我能够通过本地计算机上的烧瓶成功运行bokeh服务器

bokeh server bokeh serve--allow-websocket-origin=localhost:5000 filename.py 散景服务器bokeh serve--allow-websocket-origin=localhost:5000 filename.py

flask python run.py on two command windows 两个命令窗口上的flask python run.py

Now I want to do the same thing but on a virtual machine running ubuntu. 现在,我想在运行ubuntu的虚拟机上做同样的事情。 Using the exact same commands on two putty windows no longer work. 在两个腻子窗口上使用完全相同的命令不再起作用。 I am able to access non-bokeh html pages though. 我可以访问非bokeh html页面。

When trying to access the bokeh plot, I get: 当尝试访问散景图时,我得到:

OSError: Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command) OSError:无法提取会话文档,因为我们无法连接到服务器(要启动服务器,请尝试使用“ bokeh serve”命令)

but I already intitiated bokeh serve 但我已经开始使用bokeh serve

this is the code snippet in flask that will call bokeh server 这是烧瓶中将调用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)

edit: I'm reading something about 'linux server configuration files' for running bokeh server on linux. 编辑:我正在阅读有关在Linux上运行bokeh服务器的“ Linux服务器配置文件”的内容。 I have not made such configuration files. 我还没有制作这样的配置文件。 Can someone confirm whether these are totally necessary? 有人可以确认这些是否完全必要吗? I don't want to overstuff my project with excess. 我不想过多地增加我的项目。 In many examples I've seen, the developer uses nginx and gunicorn and other things to get flask/bokeh up and running, but so far I've been able to avoid these extra layers.. 在我见过的许多示例中,开发人员使用nginx和gunicorn等工具来启动并运行烧瓶/散景,但是到目前为止,我已经能够避免这些额外的层。

edit2: bokeh serve --show filename.py in the ubuntu terminal generates the standard messages as if it is working but it doesn't open the browser to display the figure. edit2:ubuntu终端中的bokeh serve --show filename.py生成标准消息,好像它正在工作,但不会打开浏览器显示该图。

I created the configuration files referenced in the initial post and used bokeh serve --allow-websocket-origin=(my ip):5000 filename.py . 我创建了初始文章中引用的配置文件,并使用了bokeh serve --allow-websocket-origin=(my ip):5000 filename.py

Then in the flask file from werkzeug.contrib.fixers import ProxyFix 然后在from werkzeug.contrib.fixers import ProxyFix的flask文件中from werkzeug.contrib.fixers import ProxyFix

then outside of the app.route(/) i put app.wsgi_app=ProxyFix(app.wsgi_app) 然后在app.route(/)放置app.wsgi_app=ProxyFix(app.wsgi_app)

then I navigated to (my ip):5000 然后我导航到(my ip):5000

and it worked. 而且有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 烧瓶散景服务器 - 人物甚至在本地也不渲染 - flask bokeh server - figure does not render even locally 将我的IP地址连接到Flask服务器时出错-Ubuntu IPython - Error in connecting my ip address to flask server- ubuntu ipython 从本地客户端计算机向Ubuntu服务器上的Flask服务器发送和接收数据 - Send and receive data from local client machine to a flask server on an Ubuntu server django 密码重置在服务器上不起作用,但在本地计算机上起作用 - django password reset does not work on server but works on local machine 如何在 ubuntu 服务器机器上运行 FLASK 应用程序 - How to run a FLASK app on a ubuntu server machine Selenium 在 Amazon Ubuntu 服务器(EC2)没有打开某些链接,但在本地机器上工作正常 - Selenium on Amazon Ubuntu Server (EC2) is not opening certain links but works fine on local machine 使用数据库连接将代码部署到Azure Web时,Flask应用程序无法呈现,但是在本地服务器上运行良好 - Flask app fails to render when deploying code to Azure Web with a database connection, but works fine from local server 访问 AWS ubuntu 机器映像上的本地服务器 - Access local server on AWS ubuntu machine image Flask Requests.Args 在本地机器上工作,虽然不在 Heroku 上 - Flask Requests.Args works in local machine although not on Heroku 无法读取远程Ubuntu服务器上Flask中保存的机器学习模型 - not able to read a saved machine learning model in flask on a remote Ubuntu server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM