Flask + Bokeh Server deployment issue

I can not successfully deploy my "Flask + Bokeh Server " on “Heroku”, here is everything what I have.

1, project directory:

+DataVisualization

-Data

  • *.csv

-static

-templates

-init_.py

-views.py

-Procfile

-requirements.txt

-runtime.txt

-theme.yaml

-runserver.py

  1. requirements.txt:

altgraph==0.15

bokeh==0.12.16

click==6.7

cycler==0.10.0

Flask==1.0.2

future==0.16.0

itsdangerous==0.24

Jinja2==2.10

kiwisolver==1.0.1

macholib==1.9

MarkupSafe==1.0

matplotlib==2.2.2

numpy==1.14.3

pefile==2017.11.5

py2exe==0.9.2.2

pyparsing==2.2.0

python-dateutil==2.7.3

pytz==2018.4

pywin32-ctypes==0.1.2

six==1.11.0

tornado==5.0.2

Werkzeug==0.14.1

  1. Procfile :

web: bokeh serve \

–port=$PORT \

 --log-level=debug \

 --allow-websocket-origin=pddatasetvisualization.herokuapp.com

 --host=pddatasetvisualization.herokuapp.com \

 --host=* --address=0.0.0.0 \

 --use-xheaders runserver.py
  1. runtime.txt:

python-3.6.5

  1. runserver.py:

from os import environ

from DataVisualizationWebApp import app, views

from threading import Thread

Thread(target=views.bk_worker).start()

if name == ‘main’:

app.run(host='0.0.0.0',  port=8080)

``

 6. views.py

def bk_worker():

# Can't pass num_procs > 1 in this configuration. If you need to run multiple

# processes, see e.g. flask_gunicorn_embed.py

#server = Server({'/bkapp': modify_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])

#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["localhost:15264"])

server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["0.0.0.0:8080"])



#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop())

server.start()

server.io_loop.start()

``

  1. also views.py

“”"

Routes and views for the flask application.

“”"

from datetime import datetime

from DataVisualizationWebApp import bk_plotter as bk_plter

from DataVisualizationWebApp import bk_bar_stacked as bk_bar__stacked_plter

from DataVisualizationWebApp import importdata as dataLoader

from flask import Flask, render_template, request

from DataVisualizationWebApp import app

from flask import Flask, render_template

from bokeh.embed import server_document

from bokeh.layouts import column

from bokeh.models import ColumnDataSource, Slider

from bokeh.plotting import figure, curdoc

from bokeh.server.server import Server

from bokeh.themes import Theme

from tornado.ioloop import IOLoop

from bokeh.io import curdoc

from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature

#paramater

@app.route(‘/’, methods=[‘GET’])

def bkapp_page():

"""Renders the home page."""    

#script = server_document('http://localhost:5006/bkapp')

script = server_document('https://0.0.0.0:5006/bkapp')



#return render_template("index.html", script=script, template="Flask")

return render_template("embed.html", script=script, template="Flask")

``

any comments, highly appreciated. after I finished this project, I will post all my code here for anyone else reference. thanks a lot

this is what I got from log

2018-06-26T16:32:56.022950+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T16:50:12.957976+00:00 heroku[--use-xheaders.1]: State changed from crashed to starting
2018-06-26T16:50:22.209917+00:00 heroku[--use-xheaders.1]: Starting process with command `runserver.py`
2018-06-26T16:50:22.936457+00:00 heroku[--use-xheaders.1]: State changed from starting to up
2018-06-26T16:50:24.638321+00:00 heroku[--use-xheaders.1]: Process exited with status 127
2018-06-26T16:50:24.670204+00:00 heroku[--use-xheaders.1]: State changed from up to crashed
2018-06-26T16:50:24.574760+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T17:11:13.574387+00:00 heroku[web.1]: Unidling
2018-06-26T17:11:13.590291+00:00 heroku[web.1]: State changed from down to starting
2018-06-26T17:11:26.198402+00:00 heroku[web.1]: Starting process with command `bokeh serve \`
2018-06-26T17:12:28.960662+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=pddatasetvisualization.herokuapp.com request_id=f36aac27-efb7-4693-a24e-1f9d75268066 fwd="74.3.133.82" dyno= connect= service= status=503 bytes= protocol=https

``

···

On Tuesday, June 26, 2018 at 10:25:56 AM UTC-6, peng wang wrote:

I can not successfully deploy my "Flask + Bokeh Server " on “Heroku”, here is everything what I have.

1, project directory:

+DataVisualization

-Data

  • *.csv

-static

-templates

-init_.py

-views.py

-Procfile

-requirements.txt

-runtime.txt

-theme.yaml

-runserver.py

  1. requirements.txt:

altgraph==0.15

bokeh==0.12.16

click==6.7

cycler==0.10.0

Flask==1.0.2

future==0.16.0

itsdangerous==0.24

Jinja2==2.10

kiwisolver==1.0.1

macholib==1.9

MarkupSafe==1.0

matplotlib==2.2.2

numpy==1.14.3

pefile==2017.11.5

py2exe==0.9.2.2

pyparsing==2.2.0

python-dateutil==2.7.3

pytz==2018.4

pywin32-ctypes==0.1.2

six==1.11.0

tornado==5.0.2

Werkzeug==0.14.1

  1. Procfile :

web: bokeh serve \

–port=$PORT \

–log-level=debug \

–allow-websocket-origin=pddatasetvisualization.herokuapp.com

–host=pddatasetvisualization.herokuapp.com \

–host=* --address=0.0.0.0 \

–use-xheaders runserver.py

  1. runtime.txt:

python-3.6.5

  1. runserver.py:

from os import environ

from DataVisualizationWebApp import app, views

from threading import Thread

Thread(target=views.bk_worker).start()

if name == ‘main’:

app.run(host='0.0.0.0',  port=8080)

``

  1. views.py

def bk_worker():

# Can't pass num_procs > 1 in this configuration. If you need to run multiple
# processes, see e.g. flask_gunicorn_embed.py
#server = Server({'/bkapp': modify_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["localhost:15264"])
server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["[0.0.0.0:8080](http://0.0.0.0:8080)"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop())
server.start()
server.io_loop.start()

``

  1. also views.py

“”"

Routes and views for the flask application.

“”"

from datetime import datetime

from DataVisualizationWebApp import bk_plotter as bk_plter

from DataVisualizationWebApp import bk_bar_stacked as bk_bar__stacked_plter

from DataVisualizationWebApp import importdata as dataLoader

from flask import Flask, render_template, request

from DataVisualizationWebApp import app

from flask import Flask, render_template

from bokeh.embed import server_document

from bokeh.layouts import column

from bokeh.models import ColumnDataSource, Slider

from bokeh.plotting import figure, curdoc

from bokeh.server.server import Server

from bokeh.themes import Theme

from tornado.ioloop import IOLoop

from bokeh.io import curdoc

from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature

#paramater

@app.route(‘/’, methods=[‘GET’])

def bkapp_page():

"""Renders the home page."""    
#script = server_document('[http://localhost:5006/bkapp](http://localhost:5006/bkapp)')
script = server_document('[https://0.0.0.0:5006/bkapp](https://0.0.0.0:5006/bkapp)')
#return render_template("index.html", script=script, template="Flask")
return render_template("embed.html", script=script, template="Flask")

``

any comments, highly appreciated. after I finished this project, I will post all my code here for anyone else reference. thanks a lot

2018-06-26T15:13:11.315748+00:00 heroku[web.1]: Unidling

2018-06-26T15:13:11.318199+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:13:22.108084+00:00 heroku[web.1]: Starting process with command bokeh serve \

2018-06-26T15:14:26.512267+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path=“/” host=pddatasetvisu

lization.herokuapp.com request_id=ba294fca-cb78-4a9d-8c1f-126c639a1e34 fwd=“74.3.133.82” dyno= connect= service= status=503 bytes

protocol=https

2018-06-26T15:15:13.354413+00:00 heroku[web.1]: State changed from starting to down

2018-06-26T15:16:29.111319+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:16:29.155876+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:16:37.506772+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:16:38.082887+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:16:39.348292+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:16:39.290146+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:16:39.362489+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:16:39.364851+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:16:39.646079+00:00 heroku[web.1]: Starting process with command gunicorn \

2018-06-26T15:16:47.874941+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:16:48.598364+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:16:49.698695+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:16:49.777166+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:16:49.753852+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:17:55.019111+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path=“/” host=pddatasetvisu

lization.herokuapp.com request_id=9cbdd753-5cf6-4414-86a5-ad53f5f230b5 fwd=“74.3.133.82” dyno= connect= service= status=503 bytes

protocol=https

2018-06-26T15:18:31.157899+00:00 heroku[web.1]: State changed from starting to down

2018-06-26T15:28:45.752528+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:28:45.809646+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:28:54.652937+00:00 heroku[web.1]: Starting process with command gunicorn runserver:app \

2018-06-26T15:28:58.508453+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:28:59.145762+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:29:00.402928+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:29:00.441938+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:29:00.460030+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:29:00.462981+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:29:07.766677+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:29:08.503294+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:29:09.436912+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

``

···

On Tuesday, June 26, 2018 at 11:13:26 AM UTC-6, peng wang wrote:

this is what I got from log

2018-06-26T16:32:56.022950+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T16:50:12.957976+00:00 heroku[--use-xheaders.1]: State changed from crashed to starting
2018-06-26T16:50:22.209917+00:00 heroku[--use-xheaders.1]: Starting process with command `runserver.py`
2018-06-26T16:50:22.936457+00:00 heroku[--use-xheaders.1]: State changed from starting to up
2018-06-26T16:50:24.638321+00:00 heroku[--use-xheaders.1]: Process exited with status 127
2018-06-26T16:50:24.670204+00:00 heroku[--use-xheaders.1]: State changed from up to crashed
2018-06-26T16:50:24.574760+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T17:11:13.574387+00:00 heroku[web.1]: Unidling
2018-06-26T17:11:13.590291+00:00 heroku[web.1]: State changed from down to starting
2018-06-26T17:11:26.198402+00:00 heroku[web.1]: Starting process with command `bokeh serve \`
2018-06-26T17:12:28.960662+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com) request_id=f36aac27-efb7-4693-a24e-1f9d75268066 fwd="74.3.133.82" dyno= connect= service= status=503 bytes= protocol=https

``

On Tuesday, June 26, 2018 at 10:25:56 AM UTC-6, peng wang wrote:

I can not successfully deploy my "Flask + Bokeh Server " on “Heroku”, here is everything what I have.

1, project directory:

+DataVisualization

-Data

  • *.csv

-static

-templates

-init_.py

-views.py

-Procfile

-requirements.txt

-runtime.txt

-theme.yaml

-runserver.py

  1. requirements.txt:

altgraph==0.15

bokeh==0.12.16

click==6.7

cycler==0.10.0

Flask==1.0.2

future==0.16.0

itsdangerous==0.24

Jinja2==2.10

kiwisolver==1.0.1

macholib==1.9

MarkupSafe==1.0

matplotlib==2.2.2

numpy==1.14.3

pefile==2017.11.5

py2exe==0.9.2.2

pyparsing==2.2.0

python-dateutil==2.7.3

pytz==2018.4

pywin32-ctypes==0.1.2

six==1.11.0

tornado==5.0.2

Werkzeug==0.14.1

  1. Procfile :

web: bokeh serve \

–port=$PORT \

--log-level=debug \
--allow-websocket-origin=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com)
--host=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com) \
--host=* --address=0.0.0.0 \
--use-xheaders runserver.py
  1. runtime.txt:

python-3.6.5

  1. runserver.py:

from os import environ

from DataVisualizationWebApp import app, views

from threading import Thread

Thread(target=views.bk_worker).start()

if name == ‘main’:

app.run(host='0.0.0.0',  port=8080)

``

6. views.py

def bk_worker():

# Can't pass num_procs > 1 in this configuration. If you need to run multiple
# processes, see e.g. flask_gunicorn_embed.py
#server = Server({'/bkapp': modify_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["localhost:15264"])
server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["[0.0.0.0:8080](http://0.0.0.0:8080)"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop())
server.start()
server.io_loop.start()

``

  1. also views.py

“”"

Routes and views for the flask application.

“”"

from datetime import datetime

from DataVisualizationWebApp import bk_plotter as bk_plter

from DataVisualizationWebApp import bk_bar_stacked as bk_bar__stacked_plter

from DataVisualizationWebApp import importdata as dataLoader

from flask import Flask, render_template, request

from DataVisualizationWebApp import app

from flask import Flask, render_template

from bokeh.embed import server_document

from bokeh.layouts import column

from bokeh.models import ColumnDataSource, Slider

from bokeh.plotting import figure, curdoc

from bokeh.server.server import Server

from bokeh.themes import Theme

from tornado.ioloop import IOLoop

from bokeh.io import curdoc

from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature

#paramater

@app.route(‘/’, methods=[‘GET’])

def bkapp_page():

"""Renders the home page."""    
#script = server_document('[http://localhost:5006/bkapp](http://localhost:5006/bkapp)')
script = server_document('[https://0.0.0.0:5006/bkapp](https://0.0.0.0:5006/bkapp)')
#return render_template("index.html", script=script, template="Flask")
return render_template("embed.html", script=script, template="Flask")

``

any comments, highly appreciated. after I finished this project, I will post all my code here for anyone else reference. thanks a lot

After modify my Procfile, the current log is posted below, it looks that everything works properly, but when I issue “heroku open” the website automatically goes to “https://pddatasetvisualization.herokuapp.com/runserver”. if I go to “https://pddatasetvisualization.herokuapp.com:8080”. nothing is displayed.

any suggestions? thanks a lot.

2018-06-26T20:23:15.403395+00:00 heroku[router]: at=info method=GET path="/" host=pddatasetvisualization.herokuapp.com request_id=9aceef25-32b6-4dd1-8ffa-a6c86a0f4f8d fwd="74.3.133.82" dyno=web.1 connect=1ms service=5ms status=302 bytes=188 protocol=https
2018-06-26T20:23:15.401527+00:00 app[web.1]: 2018-06-26 20:23:15,401 302 GET / (74.3.133.82) 1.41ms
2018-06-26T20:23:15.811139+00:00 heroku[router]: at=info method=GET path="/runserver" host=pddatasetvisualization.herokuapp.com request_id=7e1d9baf-c2cc-4960-bc06-eadd7a6287cc fwd="74.3.133.82" dyno=web.1 connect=1ms service=258ms status=200 bytes=3055 protocol=https
2018-06-26T20:23:15.791521+00:00 app[web.1]: 2018-06-26 20:23:15,791 Using selector: EpollSelector
2018-06-26T20:23:15.793226+00:00 app[web.1]: 2018-06-26 20:23:15,793 Starting Bokeh server version 0.12.16 (running on Tornado 5.0.2)
2018-06-26T20:23:15.796668+00:00 app[web.1]: Exception in thread Thread-1:
2018-06-26T20:23:15.796671+00:00 app[web.1]: Traceback (most recent call last):
2018-06-26T20:23:15.796673+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/threading.py", line 916, in _bootstrap_inner
2018-06-26T20:23:15.796675+00:00 app[web.1]:     self.run()
2018-06-26T20:23:15.796677+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/threading.py", line 864, in run
2018-06-26T20:23:15.796678+00:00 app[web.1]:     self._target(*self._args, **self._kwargs)
2018-06-26T20:23:15.796680+00:00 app[web.1]:   File "/app/DataVisualizationWebApp/views.py", line 71, in bk_worker
2018-06-26T20:23:15.796682+00:00 app[web.1]:     server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])
2018-06-26T20:23:15.796684+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/server/server.py", line 390, in __init__
2018-06-26T20:23:15.796686+00:00 app[web.1]:     sockets, self._port = bind_sockets(self.address, self.port)
2018-06-26T20:23:15.796688+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/server/util.py", line 32, in bind_sockets
2018-06-26T20:23:15.796689+00:00 app[web.1]:     ss = netutil.bind_sockets(port=port or 0, address=address)
2018-06-26T20:23:15.796691+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/tornado/netutil.py", line 163, in bind_sockets
2018-06-26T20:23:15.796693+00:00 app[web.1]:     sock.bind(sockaddr)
2018-06-26T20:23:15.796694+00:00 app[web.1]: OSError: [Errno 98] Address already in use
2018-06-26T20:23:15.796728+00:00 app[web.1]:
2018-06-26T20:23:15.809352+00:00 app[web.1]: 2018-06-26 20:23:15,809 200 GET /runserver (74.3.133.82) 254.49ms
2018-06-26T20:23:16.053422+00:00 app[web.1]: 2018-06-26 20:23:16,053 [pid 17] 0 clients connected
2018-06-26T20:23:16.053504+00:00 app[web.1]: 2018-06-26 20:23:16,053 [pid 17]   /bkapp has 0 sessions with 0 unused
2018-06-26T20:23:16.709137+00:00 app[web.1]: 2018-06-26 20:23:16,708 101 GET /runserver/ws?bokeh-protocol-version=1.0&bokeh-session-id=qYWSaITYPk5S7lVnFrCFf8QQY737mXV0PH7FjmYHRUkn (74.3.133.82) 1.13ms
2018-06-26T20:23:16.709361+00:00 app[web.1]: 2018-06-26 20:23:16,709 WebSocket connection opened
2018-06-26T20:23:16.710091+00:00 app[web.1]: 2018-06-26 20:23:16,709 Receiver created for Protocol('1.0')
2018-06-26T20:23:16.710223+00:00 app[web.1]: 2018-06-26 20:23:16,710 ProtocolHandler created for Protocol('1.0')
2018-06-26T20:23:16.710313+00:00 app[web.1]: 2018-06-26 20:23:16,710 ServerConnection created
2018-06-26T20:23:16.804475+00:00 app[web.1]: 2018-06-26 20:23:16,804 Sending pull-doc-reply from session 'qYWSaITYPk5S7lVnFrCFf8QQY737mXV0PH7FjmYHRUkn'
2018-06-26T20:23:20.146248+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 16] 1 clients connected
2018-06-26T20:23:20.146266+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 18] 0 clients connected
2018-06-26T20:23:20.146424+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 18]   /runserver has 0 sessions with 0 unused
2018-06-26T20:23:20.146517+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 16]   /runserver has 1 sessions with 0 unused
2018-06-26T20:23:20.146759+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 17] 0 clients connected
2018-06-26T20:23:20.146906+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 17]   /runserver has 0 sessions with 0 unused
2018-06-26T20:23:20.148991+00:00 app[web.1]: 2018-06-26 20:23:20,148 [pid 19] 0 clients connected
2018-06-26T20:23:20.149178+00:00 app[web.1]: 2018-06-26 20:23:20,149 [pid 19]   /runserver has 0 sessions with 0 unused
2018-06-26T20:23:20.153296+00:00 app[web.1]: 2018-06-26 20:23:20,153 [pid 21] 1 clients connected

``

···

On Tuesday, June 26, 2018 at 11:15:18 AM UTC-6, peng wang wrote:

2018-06-26T15:13:11.315748+00:00 heroku[web.1]: Unidling

2018-06-26T15:13:11.318199+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:13:22.108084+00:00 heroku[web.1]: Starting process with command bokeh serve \

2018-06-26T15:14:26.512267+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path=“/” host=pddatasetvisu

lization.herokuapp.com request_id=ba294fca-cb78-4a9d-8c1f-126c639a1e34 fwd=“74.3.133.82” dyno= connect= service= status=503 bytes

protocol=https

2018-06-26T15:15:13.354413+00:00 heroku[web.1]: State changed from starting to down

2018-06-26T15:16:29.111319+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:16:29.155876+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:16:37.506772+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:16:38.082887+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:16:39.348292+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:16:39.290146+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:16:39.362489+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:16:39.364851+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:16:39.646079+00:00 heroku[web.1]: Starting process with command gunicorn \

2018-06-26T15:16:47.874941+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:16:48.598364+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:16:49.698695+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:16:49.777166+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:16:49.753852+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:17:55.019111+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path=“/” host=pddatasetvisu

lization.herokuapp.com request_id=9cbdd753-5cf6-4414-86a5-ad53f5f230b5 fwd=“74.3.133.82” dyno= connect= service= status=503 bytes

protocol=https

2018-06-26T15:18:31.157899+00:00 heroku[web.1]: State changed from starting to down

2018-06-26T15:28:45.752528+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:28:45.809646+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:28:54.652937+00:00 heroku[web.1]: Starting process with command gunicorn runserver:app \

2018-06-26T15:28:58.508453+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:28:59.145762+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:29:00.402928+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:29:00.441938+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:29:00.460030+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:29:00.462981+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:29:07.766677+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:29:08.503294+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:29:09.436912+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

``

On Tuesday, June 26, 2018 at 11:13:26 AM UTC-6, peng wang wrote:

this is what I got from log

2018-06-26T16:32:56.022950+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T16:50:12.957976+00:00 heroku[--use-xheaders.1]: State changed from crashed to starting
2018-06-26T16:50:22.209917+00:00 heroku[--use-xheaders.1]: Starting process with command `runserver.py`
2018-06-26T16:50:22.936457+00:00 heroku[--use-xheaders.1]: State changed from starting to up
2018-06-26T16:50:24.638321+00:00 heroku[--use-xheaders.1]: Process exited with status 127
2018-06-26T16:50:24.670204+00:00 heroku[--use-xheaders.1]: State changed from up to crashed
2018-06-26T16:50:24.574760+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T17:11:13.574387+00:00 heroku[web.1]: Unidling
2018-06-26T17:11:13.590291+00:00 heroku[web.1]: State changed from down to starting
2018-06-26T17:11:26.198402+00:00 heroku[web.1]: Starting process with command `bokeh serve \`
2018-06-26T17:12:28.960662+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com) request_id=f36aac27-efb7-4693-a24e-1f9d75268066 fwd="74.3.133.82" dyno= connect= service= status=503 bytes= protocol=https

``

On Tuesday, June 26, 2018 at 10:25:56 AM UTC-6, peng wang wrote:

I can not successfully deploy my "Flask + Bokeh Server " on “Heroku”, here is everything what I have.

1, project directory:

+DataVisualization

-Data

  • *.csv

-static

-templates

-init_.py

-views.py

-Procfile

-requirements.txt

-runtime.txt

-theme.yaml

-runserver.py

  1. requirements.txt:

altgraph==0.15

bokeh==0.12.16

click==6.7

cycler==0.10.0

Flask==1.0.2

future==0.16.0

itsdangerous==0.24

Jinja2==2.10

kiwisolver==1.0.1

macholib==1.9

MarkupSafe==1.0

matplotlib==2.2.2

numpy==1.14.3

pefile==2017.11.5

py2exe==0.9.2.2

pyparsing==2.2.0

python-dateutil==2.7.3

pytz==2018.4

pywin32-ctypes==0.1.2

six==1.11.0

tornado==5.0.2

Werkzeug==0.14.1

  1. Procfile :

web: bokeh serve \

–port=$PORT \

--log-level=debug \
--allow-websocket-origin=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com)
--host=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com) \
--host=* --address=0.0.0.0 \
--use-xheaders runserver.py
  1. runtime.txt:

python-3.6.5

  1. runserver.py:

from os import environ

from DataVisualizationWebApp import app, views

from threading import Thread

Thread(target=views.bk_worker).start()

if name == ‘main’:

app.run(host='0.0.0.0',  port=8080)

``

6. views.py

def bk_worker():

# Can't pass num_procs > 1 in this configuration. If you need to run multiple
# processes, see e.g. flask_gunicorn_embed.py
#server = Server({'/bkapp': modify_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["localhost:15264"])
server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["[0.0.0.0:8080](http://0.0.0.0:8080)"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop())
server.start()
server.io_loop.start()

``

  1. also views.py

“”"

Routes and views for the flask application.

“”"

from datetime import datetime

from DataVisualizationWebApp import bk_plotter as bk_plter

from DataVisualizationWebApp import bk_bar_stacked as bk_bar__stacked_plter

from DataVisualizationWebApp import importdata as dataLoader

from flask import Flask, render_template, request

from DataVisualizationWebApp import app

from flask import Flask, render_template

from bokeh.embed import server_document

from bokeh.layouts import column

from bokeh.models import ColumnDataSource, Slider

from bokeh.plotting import figure, curdoc

from bokeh.server.server import Server

from bokeh.themes import Theme

from tornado.ioloop import IOLoop

from bokeh.io import curdoc

from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature

#paramater

@app.route(‘/’, methods=[‘GET’])

def bkapp_page():

"""Renders the home page."""    
#script = server_document('[http://localhost:5006/bkapp](http://localhost:5006/bkapp)')
script = server_document('[https://0.0.0.0:5006/bkapp](https://0.0.0.0:5006/bkapp)')
#return render_template("index.html", script=script, template="Flask")
return render_template("embed.html", script=script, template="Flask")

``

any comments, highly appreciated. after I finished this project, I will post all my code here for anyone else reference. thanks a lot

Could someone provides me a clue why this issue happens, thanks a lot

2018-06-26T23:06:15.456011+00:00 app[web.1]: 2018-06-26 23:06:15,455 WebSocket connection opened
2018-06-26T23:06:16.148837+00:00 app[web.1]: 2018-06-26 23:06:16,147 Receiver created for Protocol('1.0')
2018-06-26T23:06:16.148978+00:00 app[web.1]: 2018-06-26 23:06:16,148 ProtocolHandler created for Protocol('1.0')
2018-06-26T23:06:16.149127+00:00 app[web.1]: 2018-06-26 23:06:16,149 ServerConnection created
2018-06-26T23:06:16.163395+00:00 app[web.1]: 2018-06-26 23:06:16,163 Using selector: EpollSelector
2018-06-26T23:06:16.163838+00:00 app[web.1]: 2018-06-26 23:06:16,163 Starting Bokeh server version 0.12.16 (running on Tornado 5.0.2)
2018-06-26T23:06:16.166924+00:00 app[web.1]: Exception in thread Thread-1:
2018-06-26T23:06:16.166927+00:00 app[web.1]: Traceback (most recent call last):
2018-06-26T23:06:16.166929+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/threading.py", line 916, in _bootstrap_inner
2018-06-26T23:06:16.166931+00:00 app[web.1]:     self.run()
2018-06-26T23:06:16.166933+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/threading.py", line 864, in run
2018-06-26T23:06:16.166935+00:00 app[web.1]:     self._target(*self._args, **self._kwargs)
2018-06-26T23:06:16.166936+00:00 app[web.1]:   File "/app/DataVisualizationWebApp/views.py", line 73, in bk_worker
2018-06-26T23:06:16.166938+00:00 app[web.1]:     server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop())
2018-06-26T23:06:16.166940+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/server/server.py", line 390, in __init__
2018-06-26T23:06:16.166942+00:00 app[web.1]:     sockets, self._port = bind_sockets(self.address, self.port)
2018-06-26T23:06:16.166944+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/server/util.py", line 32, in bind_sockets
2018-06-26T23:06:16.166946+00:00 app[web.1]:     ss = netutil.bind_sockets(port=port or 0, address=address)
2018-06-26T23:06:16.166947+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/tornado/netutil.py", line 163, in bind_sockets
2018-06-26T23:06:16.166949+00:00 app[web.1]:     sock.bind(sockaddr)
2018-06-26T23:06:16.166951+00:00 app[web.1]: OSError: [Errno 98] Address already in use
2018-06-26T23:06:16.166957+00:00 app[web.1]:
2018-06-26T23:06:16.241352+00:00 app[web.1]: 2018-06-26 23:06:16,241 Sending pull-doc-reply from session 'JxQ1Fonx4rcqkfzo9YDqKJeyTSqt2v4jkBggc2RyJbo8'
2018-06-26T23:06:18.619542+00:00 app[web.1]: 2018-06-26 23:06:18,619 [pid 16] 0 clients connected
2018-06-26T23:06:18.619680+00:00 app[web.1]: 2018-06-26 23:06:18,619 [pid 16]   /runserver has 0 sessions with 0 unused
2018-06-26T23:06:18.655743+00:00 app[web.1]: 2018-06-26 23:06:18,655 [pid 23] 0 clients connected

``

my server configuration:

def bkapp_page():

“”“Renders the home page.”“”

script = server_document(‘https://pddatasetvisualization.herokuapp.com:5006/bkapp’)

return render_template("embed.html", script=script, template="Flask")

def bk_worker():

server = Server({‘/bkapp’: bk_plter.plot_doc}, io_loop=IOLoop())

server.start()

server.io_loop.start()

``

···

On Tuesday, June 26, 2018 at 2:30:47 PM UTC-6, peng wang wrote:

After modify my Procfile, the current log is posted below, it looks that everything works properly, but when I issue “heroku open” the website automatically goes to “https://pddatasetvisualization.herokuapp.com/runserver”. if I go to “https://pddatasetvisualization.herokuapp.com:8080”. nothing is displayed.

any suggestions? thanks a lot.

2018-06-26T20:23:15.403395+00:00 heroku[router]: at=info method=GET path="/" host=pddatasetvisualization.herokuapp.com request_id=9aceef25-32b6-4dd1-8ffa-a6c86a0f4f8d fwd="74.3.133.82" dyno=web.1 connect=1ms service=5ms status=302 bytes=188 protocol=https
2018-06-26T20:23:15.401527+00:00 app[web.1]: 2018-06-26 20:23:15,401 302 GET / (74.3.133.82) 1.41ms
2018-06-26T20:23:15.811139+00:00 heroku[router]: at=info method=GET path="/runserver" host=pddatasetvisualization.herokuapp.com request_id=7e1d9baf-c2cc-4960-bc06-eadd7a6287cc fwd="74.3.133.82" dyno=web.1 connect=1ms service=258ms status=200 bytes=3055 protocol=https
2018-06-26T20:23:15.791521+00:00 app[web.1]: 2018-06-26 20:23:15,791 Using selector: EpollSelector
2018-06-26T20:23:15.793226+00:00 app[web.1]: 2018-06-26 20:23:15,793 Starting Bokeh server version 0.12.16 (running on Tornado 5.0.2)
2018-06-26T20:23:15.796668+00:00 app[web.1]: Exception in thread Thread-1:
2018-06-26T20:23:15.796671+00:00 app[web.1]: Traceback (most recent call last):
2018-06-26T20:23:15.796673+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/threading.py", line 916, in _bootstrap_inner
2018-06-26T20:23:15.796675+00:00 app[web.1]:     self.run()
2018-06-26T20:23:15.796677+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/threading.py", line 864, in run
2018-06-26T20:23:15.796678+00:00 app[web.1]:     self._target(*self._args, **self._kwargs)
2018-06-26T20:23:15.796680+00:00 app[web.1]:   File "/app/DataVisualizationWebApp/views.py", line 71, in bk_worker
2018-06-26T20:23:15.796682+00:00 app[web.1]:     server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])
2018-06-26T20:23:15.796684+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/server/server.py", line 390, in __init__
2018-06-26T20:23:15.796686+00:00 app[web.1]:     sockets, self._port = bind_sockets(self.address, self.port)
2018-06-26T20:23:15.796688+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/server/util.py", line 32, in bind_sockets
2018-06-26T20:23:15.796689+00:00 app[web.1]:     ss = netutil.bind_sockets(port=port or 0, address=address)
2018-06-26T20:23:15.796691+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/tornado/netutil.py", line 163, in bind_sockets
2018-06-26T20:23:15.796693+00:00 app[web.1]:     sock.bind(sockaddr)
2018-06-26T20:23:15.796694+00:00 app[web.1]: OSError: [Errno 98] Address already in use
2018-06-26T20:23:15.796728+00:00 app[web.1]:
2018-06-26T20:23:15.809352+00:00 app[web.1]: 2018-06-26 20:23:15,809 200 GET /runserver (74.3.133.82) 254.49ms
2018-06-26T20:23:16.053422+00:00 app[web.1]: 2018-06-26 20:23:16,053 [pid 17] 0 clients connected
2018-06-26T20:23:16.053504+00:00 app[web.1]: 2018-06-26 20:23:16,053 [pid 17]   /bkapp has 0 sessions with 0 unused
2018-06-26T20:23:16.709137+00:00 app[web.1]: 2018-06-26 20:23:16,708 101 GET /runserver/ws?bokeh-protocol-version=1.0&bokeh-session-id=qYWSaITYPk5S7lVnFrCFf8QQY737mXV0PH7FjmYHRUkn (74.3.133.82) 1.13ms
2018-06-26T20:23:16.709361+00:00 app[web.1]: 2018-06-26 20:23:16,709 WebSocket connection opened
2018-06-26T20:23:16.710091+00:00 app[web.1]: 2018-06-26 20:23:16,709 Receiver created for Protocol('1.0')
2018-06-26T20:23:16.710223+00:00 app[web.1]: 2018-06-26 20:23:16,710 ProtocolHandler created for Protocol('1.0')
2018-06-26T20:23:16.710313+00:00 app[web.1]: 2018-06-26 20:23:16,710 ServerConnection created
2018-06-26T20:23:16.804475+00:00 app[web.1]: 2018-06-26 20:23:16,804 Sending pull-doc-reply from session 'qYWSaITYPk5S7lVnFrCFf8QQY737mXV0PH7FjmYHRUkn'
2018-06-26T20:23:20.146248+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 16] 1 clients connected
2018-06-26T20:23:20.146266+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 18] 0 clients connected
2018-06-26T20:23:20.146424+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 18]   /runserver has 0 sessions with 0 unused
2018-06-26T20:23:20.146517+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 16]   /runserver has 1 sessions with 0 unused
2018-06-26T20:23:20.146759+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 17] 0 clients connected
2018-06-26T20:23:20.146906+00:00 app[web.1]: 2018-06-26 20:23:20,146 [pid 17]   /runserver has 0 sessions with 0 unused
2018-06-26T20:23:20.148991+00:00 app[web.1]: 2018-06-26 20:23:20,148 [pid 19] 0 clients connected
2018-06-26T20:23:20.149178+00:00 app[web.1]: 2018-06-26 20:23:20,149 [pid 19]   /runserver has 0 sessions with 0 unused
2018-06-26T20:23:20.153296+00:00 app[web.1]: 2018-06-26 20:23:20,153 [pid 21] 1 clients connected

``

On Tuesday, June 26, 2018 at 11:15:18 AM UTC-6, peng wang wrote:

2018-06-26T15:13:11.315748+00:00 heroku[web.1]: Unidling

2018-06-26T15:13:11.318199+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:13:22.108084+00:00 heroku[web.1]: Starting process with command bokeh serve \

2018-06-26T15:14:26.512267+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path=“/” host=pddatasetvisu

lization.herokuapp.com request_id=ba294fca-cb78-4a9d-8c1f-126c639a1e34 fwd=“74.3.133.82” dyno= connect= service= status=503 bytes

protocol=https

2018-06-26T15:15:13.354413+00:00 heroku[web.1]: State changed from starting to down

2018-06-26T15:16:29.111319+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:16:29.155876+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:16:37.506772+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:16:38.082887+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:16:39.348292+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:16:39.290146+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:16:39.362489+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:16:39.364851+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:16:39.646079+00:00 heroku[web.1]: Starting process with command gunicorn \

2018-06-26T15:16:47.874941+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:16:48.598364+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:16:49.698695+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:16:49.777166+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:16:49.753852+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:17:55.019111+00:00 heroku[router]: at=error code=H20 desc=“App boot timeout” method=GET path=“/” host=pddatasetvisu

lization.herokuapp.com request_id=9cbdd753-5cf6-4414-86a5-ad53f5f230b5 fwd=“74.3.133.82” dyno= connect= service= status=503 bytes

protocol=https

2018-06-26T15:18:31.157899+00:00 heroku[web.1]: State changed from starting to down

2018-06-26T15:28:45.752528+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:28:45.809646+00:00 heroku[web.1]: State changed from down to starting

2018-06-26T15:28:54.652937+00:00 heroku[web.1]: Starting process with command gunicorn runserver:app \

2018-06-26T15:28:58.508453+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:28:59.145762+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:29:00.402928+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

2018-06-26T15:29:00.441938+00:00 heroku[–use-xheaders.1]: Process exited with status 127

2018-06-26T15:29:00.460030+00:00 heroku[–use-xheaders.1]: State changed from up to crashed

2018-06-26T15:29:00.462981+00:00 heroku[–use-xheaders.1]: State changed from crashed to starting

2018-06-26T15:29:07.766677+00:00 heroku[–use-xheaders.1]: Starting process with command runserver.py

2018-06-26T15:29:08.503294+00:00 heroku[–use-xheaders.1]: State changed from starting to up

2018-06-26T15:29:09.436912+00:00 app[–use-xheaders.1]: bash: runserver.py: command not found

``

On Tuesday, June 26, 2018 at 11:13:26 AM UTC-6, peng wang wrote:

this is what I got from log

2018-06-26T16:32:56.022950+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T16:50:12.957976+00:00 heroku[--use-xheaders.1]: State changed from crashed to starting
2018-06-26T16:50:22.209917+00:00 heroku[--use-xheaders.1]: Starting process with command `runserver.py`
2018-06-26T16:50:22.936457+00:00 heroku[--use-xheaders.1]: State changed from starting to up
2018-06-26T16:50:24.638321+00:00 heroku[--use-xheaders.1]: Process exited with status 127
2018-06-26T16:50:24.670204+00:00 heroku[--use-xheaders.1]: State changed from up to crashed
2018-06-26T16:50:24.574760+00:00 app[--use-xheaders.1]: bash: runserver.py: command not found
2018-06-26T17:11:13.574387+00:00 heroku[web.1]: Unidling
2018-06-26T17:11:13.590291+00:00 heroku[web.1]: State changed from down to starting
2018-06-26T17:11:26.198402+00:00 heroku[web.1]: Starting process with command `bokeh serve \`
2018-06-26T17:12:28.960662+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com) request_id=f36aac27-efb7-4693-a24e-1f9d75268066 fwd="74.3.133.82" dyno= connect= service= status=503 bytes= protocol=https

``

On Tuesday, June 26, 2018 at 10:25:56 AM UTC-6, peng wang wrote:

I can not successfully deploy my "Flask + Bokeh Server " on “Heroku”, here is everything what I have.

1, project directory:

+DataVisualization

-Data

  • *.csv

-static

-templates

-init_.py

-views.py

-Procfile

-requirements.txt

-runtime.txt

-theme.yaml

-runserver.py

  1. requirements.txt:

altgraph==0.15

bokeh==0.12.16

click==6.7

cycler==0.10.0

Flask==1.0.2

future==0.16.0

itsdangerous==0.24

Jinja2==2.10

kiwisolver==1.0.1

macholib==1.9

MarkupSafe==1.0

matplotlib==2.2.2

numpy==1.14.3

pefile==2017.11.5

py2exe==0.9.2.2

pyparsing==2.2.0

python-dateutil==2.7.3

pytz==2018.4

pywin32-ctypes==0.1.2

six==1.11.0

tornado==5.0.2

Werkzeug==0.14.1

  1. Procfile :

web: bokeh serve \

–port=$PORT \

--log-level=debug \
--allow-websocket-origin=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com)
--host=[pddatasetvisualization.herokuapp.com](http://pddatasetvisualization.herokuapp.com) \
--host=* --address=0.0.0.0 \
--use-xheaders runserver.py
  1. runtime.txt:

python-3.6.5

  1. runserver.py:

from os import environ

from DataVisualizationWebApp import app, views

from threading import Thread

Thread(target=views.bk_worker).start()

if name == ‘main’:

app.run(host='0.0.0.0',  port=8080)

``

6. views.py

def bk_worker():

# Can't pass num_procs > 1 in this configuration. If you need to run multiple
# processes, see e.g. flask_gunicorn_embed.py
#server = Server({'/bkapp': modify_doc}, io_loop=IOLoop(), allow_websocket_origin=["*"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["localhost:15264"])
server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop(), allow_websocket_origin=["[0.0.0.0:8080](http://0.0.0.0:8080)"])
#server = Server({'/bkapp': bk_plter.plot_doc}, io_loop=IOLoop())
server.start()
server.io_loop.start()

``

  1. also views.py

“”"

Routes and views for the flask application.

“”"

from datetime import datetime

from DataVisualizationWebApp import bk_plotter as bk_plter

from DataVisualizationWebApp import bk_bar_stacked as bk_bar__stacked_plter

from DataVisualizationWebApp import importdata as dataLoader

from flask import Flask, render_template, request

from DataVisualizationWebApp import app

from flask import Flask, render_template

from bokeh.embed import server_document

from bokeh.layouts import column

from bokeh.models import ColumnDataSource, Slider

from bokeh.plotting import figure, curdoc

from bokeh.server.server import Server

from bokeh.themes import Theme

from tornado.ioloop import IOLoop

from bokeh.io import curdoc

from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature

#paramater

@app.route(‘/’, methods=[‘GET’])

def bkapp_page():

"""Renders the home page."""    
#script = server_document('[http://localhost:5006/bkapp](http://localhost:5006/bkapp)')
script = server_document('[https://0.0.0.0:5006/bkapp](https://0.0.0.0:5006/bkapp)')
#return render_template("index.html", script=script, template="Flask")
return render_template("embed.html", script=script, template="Flask")

``

any comments, highly appreciated. after I finished this project, I will post all my code here for anyone else reference. thanks a lot

I just spent some time trying to make pretty much exactly this work and it seems like Heroku just isn’t made to do it. It is for running a single thing on a single port and it can’t handle running eg bokeh on 5006 and gunicorn on 8080. I just responded to your other question and I went down that road after giving up on this one. The embedded server feels good but in the end running the 2 processes separately is easier and simpler (as far as I can tell at least).

totally correct, I just wonder where that example exist? kill us?

···

On Wednesday, June 27, 2018 at 5:18:12 PM UTC-6, Jack Beanland wrote:

I just spent some time trying to make pretty much exactly this work and it seems like Heroku just isn’t made to do it. It is for running a single thing on a single port and it can’t handle running eg bokeh on 5006 and gunicorn on 8080. I just responded to your other question and I went down that road after giving up on this one. The embedded server feels good but in the end running the 2 processes separately is easier and simpler (as far as I can tell at least).

totally correct, I just wonder why that example exist? kill us?

···

On Wednesday, June 27, 2018 at 5:20:20 PM UTC-6, peng wang wrote:

totally correct, I just wonder where that example exist? kill us?

On Wednesday, June 27, 2018 at 5:18:12 PM UTC-6, Jack Beanland wrote:

I just spent some time trying to make pretty much exactly this work and it seems like Heroku just isn’t made to do it. It is for running a single thing on a single port and it can’t handle running eg bokeh on 5006 and gunicorn on 8080. I just responded to your other question and I went down that road after giving up on this one. The embedded server feels good but in the end running the 2 processes separately is easier and simpler (as far as I can tell at least).

If anyone need help, I could provide help. I successfully deploy Flask + Bokeh sever on IIS

···

On Wednesday, June 27, 2018 at 5:20:58 PM UTC-6, peng wang wrote:

totally correct, I just wonder why that example exist? kill us?

On Wednesday, June 27, 2018 at 5:20:20 PM UTC-6, peng wang wrote:

totally correct, I just wonder where that example exist? kill us?

On Wednesday, June 27, 2018 at 5:18:12 PM UTC-6, Jack Beanland wrote:

I just spent some time trying to make pretty much exactly this work and it seems like Heroku just isn’t made to do it. It is for running a single thing on a single port and it can’t handle running eg bokeh on 5006 and gunicorn on 8080. I just responded to your other question and I went down that road after giving up on this one. The embedded server feels good but in the end running the 2 processes separately is easier and simpler (as far as I can tell at least).

I need help deploying flask + bokeh to digital ocean using nginx. any chance you would take a look at it?

···

On Thursday, July 5, 2018 at 1:51:55 PM UTC-6, peng wang wrote:

If anyone need help, I could provide help. I successfully deploy Flask + Bokeh sever on IIS

On Wednesday, June 27, 2018 at 5:20:58 PM UTC-6, peng wang wrote:

totally correct, I just wonder why that example exist? kill us?

On Wednesday, June 27, 2018 at 5:20:20 PM UTC-6, peng wang wrote:

totally correct, I just wonder where that example exist? kill us?

On Wednesday, June 27, 2018 at 5:18:12 PM UTC-6, Jack Beanland wrote:

I just spent some time trying to make pretty much exactly this work and it seems like Heroku just isn’t made to do it. It is for running a single thing on a single port and it can’t handle running eg bokeh on 5006 and gunicorn on 8080. I just responded to your other question and I went down that road after giving up on this one. The embedded server feels good but in the end running the 2 processes separately is easier and simpler (as far as I can tell at least).