为什么这个散景图在嵌入到 Flask App 中时没有显示?

Why is this Bokeh plot not showing up when embedded in Flask App?

我在 Python Flask 应用程序中使用 Bokeh。在 test_app.py 文件中有这个代码:

See the Code, data and output in iPython notebook...

def make_figure():
     plot = figure(tools=TOOLS, width=750, height=450, title='United States Import/Exports',
              x_axis_label='date', x_axis_type='datetime')

     plot.line(dframe.index, dframe.get('Exports'), color='#A6CEE3', legend='Exports')
     return plot


@app.route('/')
def greet():
    greetings = 'Hello World, I am BOKEH'
    plot = make_figure()
    script, div = components(plot)

    return render_template('index.html', greetings=greetings, script=script, div=div)


if __name__ == '__main__':
    app.run(debug=True)

index.html 文件中,我有以下核心部分以及所需的 jscss 链接:

<body>
   <h1>{{ greetings | safe }} </h1>
    {{ script | safe }}
    {{ div | safe }}
</body>

问题是,散景 canvas、控件等出现了,但线图本身没有出现。我在这段代码中遗漏了什么?

删除 dframe = dframe.set_index('Month'),然后你就可以开始了