Serving interactive bokeh figure on heroku

半城伤御伤魂 提交于 2019-11-27 20:18:08

I'm just going to answer my own question since I was eventually able to get this to work and nobody else has answered it yet.

I ended up with a Procfile that looked like this:

web: bokeh serve --port=$PORT --host=myapp.herokuapp.com --host=* \
     --address=0.0.0.0 --use-xheaders myapp.py

a bit of background on what all of these arguments mean (as far as I can tell):

--port: specifies the port that the bokeh server will listen on, $PORT is set by heroku

--host=myapp.herokuapp.com and --host=*: specify the host name as myapp.heroku..., the wildcard is supposed to allow all hosts to be accepted. I'm not sure this in needed anymore.

--address=0.0.0.0: I think this tells bokeh to figure out on its own, which IP address it will be on.

--use-xheaders: causes bokeh to override the remote IP and URI scheme/protocol

I'm happy to make edits to this or accept a more knowledgeable users answer if there are issues with this approach.

The accepted answer didn't work for me as written (likely due to a bokeh version difference), but since this is still one of the top hits for this question, here is my minor modification that did work:

web: bokeh serve --port=$PORT --num-procs=0 --allow-websocket-origin=myapp.herokuapp.com --address=0.0.0.0 --use-xheaders myapp.py
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!