我正在尝试通过Heroku提供交互式的bokeh图形。我想要提供的图形与此示例(example,code)基本上是等效的。我对bokeh和heroku都很陌生,所以我相信我可能错过了一些非常基本的东西——我认为我要做的事情应该很简单。
首先,我可以使用“bokeh serve --show myapp”命令在本地服务我的图形。其中,“myapp”是包括bokeh图形的Python模块的名称。请注意,“--show”标志只是提示bokeh在构建图形并运行服务器后打开浏览器窗口。
接下来,我已经创建了一个
不幸的是,有些东西出了问题,我被难住了。我尝试了很多不同的选项在我的
这段文字的意思是:
“应该可以工作吗?也许我错过了什么,需要创建一个
“更新:我粘贴了一部分我的
首先,我可以使用“bokeh serve --show myapp”命令在本地服务我的图形。其中,“myapp”是包括bokeh图形的Python模块的名称。请注意,“--show”标志只是提示bokeh在构建图形并运行服务器后打开浏览器窗口。
接下来,我已经创建了一个
heroku
账户,并且按照Heroku - Python 入门教程中的步骤创建了我的第一个应用程序。我的git存储库包括myapp
、requirements.txt
文件和Procfile
。不幸的是,有些东西出了问题,我被难住了。我尝试了很多不同的选项在我的
Procfile
中,但都没有起作用。由于bokeh serve ...
命令会启动一个服务器,那么看起来像这样的Procfile
不应该行得通吗:web: bokeh serve --port $PORT myapp
这段文字的意思是:
“应该可以工作吗?也许我错过了什么,需要创建一个
flask
应用程序来包装我的bokeh
应用程序,但据我所知,这似乎并不必要。也许有人知道一个很好的教程,将所有这些步骤结合在一起,但我还没有找到完整的教程。”“更新:我粘贴了一部分我的
heroku
日志。如何处理这个--host whitelist
问题?”2016-07-17T05:00:46.513139+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-17T05:00:46.366909+00:00 heroku[api]: Deploy 9b63d8a by me@me.com
2016-07-17T05:00:46.367087+00:00 heroku[api]: Release v4 created by me@me.com
2016-07-17T05:00:46.624937+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-17T05:00:55.188978+00:00 heroku[web.1]: Starting process with command `bokeh serve --port=39665 myapp.py`
2016-07-17T05:00:57.876287+00:00 app[web.1]: 2016-07-17 05:00:57,876 Starting Bokeh server on port 39665 with applications at paths ['/myapp']
2016-07-17T05:00:57.868758+00:00 app[web.1]: 2016-07-17 05:00:57,868 Starting Bokeh server version 0.12.0
2016-07-17T05:00:57.876378+00:00 app[web.1]: 2016-07-17 05:00:57,876 Starting Bokeh server with process id: 3
2016-07-17T05:00:58.800309+00:00 heroku[web.1]: State changed from starting to up
2016-07-17T05:00:59.970326+00:00 app[web.1]: 2016-07-17 05:00:59,970 Rejected connection from host 'myapp.herokuapp.com' because it is not in the --host whitelist
2016-07-17T05:00:59.973495+00:00 app[web.1]: 2016-07-17 05:00:59,970 403 GET / (XX.XX.XXX.XX) 1.29ms
2016-07-17T05:00:59.975282+00:00 heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=xxxxxxxxxxxxx fwd="XX.XX.XX.XX" dyno=web.1 connect=1ms service=4ms status=403 bytes=219
web: gunicorn app:app web: bokeh serve --port=$PORT --host=bokehapp.herokuapp.com --host=* --address=0.0.0.0 --use-xheaders bokeh_plot.py
。这样可以在bokeh.herokuapp.com/bokeh_plot上显示图表,但无法显示Flask提供的内容。似乎服务器只读取第二行。你有什么想法吗? - multigoodverse