Serving an interactive bokeh figure on a geroku

I am trying to use an interactive bokeh digit through a hero. The metric I'm trying to execute is essentially equivalent to this ( example , code ). I'm new to both bokeh and heroku , so I'm sure I have something pretty simple. I think that what I am trying to do should be fairly simple.

First, I can use my shape locally using the bokeh serve --show myapp command. Where myapp is the name of the python module that includes the bokeh digit. Note that the --show flag simply offers bokeh to open a browser window after creating a picture and server.

Then I set up a heroku account and created my first application by following the steps in Heroku - Getting started with the Python tutorial . My git repository includes myapp , a requirements.txt and Procfile .

Alas, something is not working, and I'm at a standstill. I tried a bunch of different options in my Procfile and no one worked. Since the bokeh serve ... command starts the server, the Profile should not look, which looks like this:

 web: bokeh serve --port $PORT myapp 

Should this work? Maybe something is missing for me and I need to create a flask application that goes around my bokeh application, but as far as I can tell, this doesn't seem necessary. Maybe someone knows a good tutorial that brings all these steps together, I haven't found it yet.

Update: I am inserting a few of my heroku logs below. How do you deal with this --host whitelist problem?

 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 
+6
source share
1 answer

I'm just going to answer my question, because in the end I managed to get it to work, and no one 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 as to what all these arguments mean (as far as I can tell):

--port : indicates the port that the bokeh server will listen on, $PORT installed by heroku

--host=myapp.herokuapp.com and --host=* : specify the host name as myapp.heroku... , the wildcard should allow all hosts. I am no longer sure of this.

--address=0.0.0.0 : I think this tells bokeh to figure out which IP address it will include.

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

I am happy to make changes to this or to accept more knowledgeable users if there are problems with this approach.

+8
source

All Articles