Python 在烧瓶中未找到模板
Flask将尝试在templates文件夹中查找HTML文件,该文件夹与此脚本所在的文件夹相同Python 在烧瓶中未找到模板,python,flask,Python,Flask,Flask将尝试在templates文件夹中查找HTML文件,该文件夹与此脚本所在的文件夹相同 from flask import Flask,render_template app = Flask(__name__, template_folder='home/root13/webapp.html/staic/') @app.route("/index.html") def hello(): return render_template('index.html') @ap
from flask import Flask,render_template
app = Flask(__name__, template_folder='home/root13/webapp.html/staic/')
@app.route("/index.html")
def hello():
return render_template('index.html')
@app.route("/home")
def hello_world():
return render_template('post.html')
if __name__ == "__main__":
app.run(debug=True)
您应该将所有HTML文件放在名为templates的文件夹中,如果您像问题中那样覆盖模板文件夹,该怎么办?
-Application folder
-Hello.py
-templates
-hello.html