Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在烧瓶中未找到模板_Python_Flask - Fatal编程技术网

Python 在烧瓶中未找到模板

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

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')


@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