Serving interactive bokeh figure on heroku

前端 未结 2 1525
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 08:29

I\'m trying to serve an interactive bokeh figure via heroku. The figure I\'m trying to have served is essentially equivalent to this one (example, code). I\'m

相关标签:
2条回答
  • 2020-12-05 09:09

    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.

    0 讨论(0)
  • 2020-12-05 09:13

    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
    
    0 讨论(0)
提交回复
热议问题