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 new to both bokeh
and heroku
so I'm pretty sure I'm missing something pretty basic -- I think what I'm trying to do should be quite straightforward.
First, I can serve my figure locally using the bokeh serve --show myapp
command. Where myapp
is the name of the python module that includes the bokeh
figure. Note that the --show
flag just prompts bokeh
to open a browser window once the figure is built and the server is running.
Next, I've setup a heroku
account, and created my first app, following the steps in the Heroku - Getting Started With Python tutorial. My git repository includes myapp
, a requirements.txt
file, and Procfile
.
Alas, something is not working and I'm stumped. I have tried a bunch of different options in my Procfile
and none have worked. Since the bokeh serve ...
command starts a server, shouldn't a Procfile
that looks like this do the trick:
web: bokeh serve --port $PORT myapp
Should that work? Perhaps I'm missing something and I need to create a flask
app that wraps around my bokeh
app but as far as I can tell, that doesn't seem necessary. Maybe someone knows of a nice tutorial that pulls all of these steps together, I haven't found a complete one yet.
Update:
I'm pasting a bit of my heroku
logs below. How do you handle this --host whitelist
issue?
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 [email protected]
2016-07-17T05:00:46.367087+00:00 heroku[api]: Release v4 created by [email protected]
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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…