运行 routes.py
@app.route('/articles', methods=['GET', 'POST'])
def articles():
upload()
return render_template('articles.html')
而这个保存图像并处理其信息的功能
def upload():
if request.method == 'POST':
# Save the file to static/uploads
label = "some string from process above"
probability = "another string"
return None
return None
如何在渲染模板时使用变量标签和概率?有些人使用接近于:
return render_template('articles.html', label=label, probability=probability)
这样做是为了使用 js 引用变量。但是,如果它是在 upload() 内部计算的,我该如何引用该变量?需要全局变量吗?
慕慕森
相关分类