I have a Flask app where I have embedded a Bokeh server graph and I am not being able to have them both working on Heroku. I am trying to deploy on Heorku and I can either start the Bokeh app or the Flask app from the Procfile, but not both at the same time. Consequently, either the content served with Flask will show, or the Bokeh graph.
When I deploy with the following line in Procfile, the Bokeh content shows up on the webpage, but not nothing from Flask:
web: bokeh serve --port=$PORT --host=bokehapp.herokuapp.com --host=* --address=0.0.0.0 --use-xheaders bokeh_script.py
If I deploy with the following, I only get the Flask content, not the Bokeh graph:
web: gunicorn app:app
In the second case, I am starting Bokeh inside the app.py Flask script using a subprocess:
bokeh_process = subprocess.Popen(
['bokeh', 'serve','--allow-websocket-origin=bokehapp.herokuapp.com','--log-level=debug','standard_way_with_curdoc.py'], stdout=subprocess.PIPE)
The Heroku logs don't show any errors.
I also tried a third alternative:
web: bokeh serve --port=$PORT --host=bokehapp.herokuapp.com --host=* --address=0.0.0.0 --use-xheaders bokeh_script.py
web: gunicorn app:app
And that shows Flask content only. It seems only second worker is being considered.
So, my question is how modify the Procfile to consider both processes? Or maybe I am approaching this wrong all together? Any clue you can give would be appreciated.