2017-03-28 5 views
0

私はbokehとherokuをどのように組み合わせるかを考えようとしています。 以下のコードをローカルで実行すると、次の出力が表示されます。herokuでbokeh appを実行するには

enter image description here しかし、ここでは空のブラウザページがあります。だから、私は自分の間違いを知ることができませんでした。あなたはそれを手伝ってもらえますか?ここで私が使用したコードです:

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 

答えて

0

私はそれがコード記述のセッションで行を削除し、以下を追加して動作するように作られた:

curdoc().add_root(p) 

また、ボケサーバーを実行するコマンドを含むファイルの名前はProcfileでなければならないことに注意してくださいと入力してください。Proctofileと入力してください。

+0

さらに詳しい情報を追加 –

関連する問題