0
我想弄清楚如何結合散景和heroku。 當我在本地運行下面的代碼,我得到以下輸出:如何在heroku上運行散景應用程序
但是,在hereku,我得到一個空的瀏覽器頁面。所以我不知道你是否是我的錯。你能幫我解決嗎?下面是我的代碼使用方法:
mytest.py
import numpy as np
from numpy import pi
from bokeh.client import push_session
from bokeh.driving import cosine
from bokeh.plotting import figure, curdoc
x = np.linspace(0, 4*pi, 80)
y = np.sin(x)
p = figure()
r1 = p.line([0, 4*pi], [-1, 1], color="firebrick")
r2 = p.line(x, y, color="navy", line_width=4)
# open a session to keep our local document in sync with server
session = push_session(curdoc())
@cosine(w=0.03)
def update(step):
# updating a single column of the the *same length* is OK
r2.data_source.data["y"] = y * step
r2.glyph.line_alpha = 1 - 0.8 * abs(step)
curdoc().add_periodic_callback(update, 50)
session.show(p) # open the document in a browser
session.loop_until_closed() # run forever
requirements.txt
appdirs==1.4.3
backports-abc==0.5
bokeh==0.12.4
certifi==2017.1.23
futures==3.0.5
Jinja2==2.9.5
MarkupSafe==1.0
numpy==1.12.1
packaging==16.8
pyparsing==2.2.0
python-dateutil==2.6.0
PyYAML==3.12
requests==2.13.0
singledispatch==3.4.0.3
six==1.10.0
tornado==4.4.2
Proctofile
web: bokeh serve --port=$PORT --host=protected-sands-65334.herokuapp.com --host=* --address=0.0.0.0 --use-xheaders mytest.py
添加更多信息 –