应用程序.py
@app.route('/liveplots', methods=["POST", "GET"])
def liveplots():
global liveclass
return render_template('liveplotframe.html', image=liveclass.get_plot())
liveplotframe.html
<div id='hi'></div>
<img src="{{image}}" />
因此,现在如果图像是由 base64.b64encode() 编码的单个图像,则此方法有效
但是,我似乎无法让它适用于此类图像的列表或字典。在 app.py 我想 render_template('liveplotframe.html', list_of_images=liveclass.get_plots())
然后在我的 html 中插入一个为每个创建图像的脚本。
有没有一种简单的方法可以做到这一点?我正在使用烧瓶。