我正在尝试部署一个 Flask 应用程序,我想要一个带有 html 文件列表的 flask.render_template() 方法。在这里我看到它是合格的。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()
Run Code Online (Sandbox Code Playgroud)
但实际上服务器只返回列表中的第一个模板。如何遍历此列表以呈现列表中的所有模板?
谢谢,亚历克斯