我正在尝试部署一个flask应用程序,我想要一个flask.render_template()方法和一个html文件列表一起传递。在这里我看到它是合格的。http://flask.pocoo.org/docs/0.12/api/#flask.render_template
我在尝试这个密码
from flask import Flask, render_template
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello():
templs = ["_header.html", "_footer.html"]
return render_template(templs)
if __name__== '__main__':
app.run()
但实际上,服务器只返回列表中的第一个模板。 如何遍历此列表以呈现列表中的所有模板?
谢谢, 亚历克斯
目前没有回答
相关问题 更多 >
编程相关推荐