Python 使用烧瓶、模板。找不到错误模板

Python 使用烧瓶、模板。找不到错误模板,python,flask,Python,Flask,flaskblog.py包含代码 from flask import Flask, render_template app = Flask(__name__) @app.route('/') @app.route('/home') def home(): return render_template('home.html') @app.route('/about') def about(): return '<h1> About page!</h1>'

flaskblog.py包含代码

from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
@app.route('/home')
def home():
    return render_template('home.html')

@app.route('/about')
def about():
    return '<h1> About page!</h1>'


if __name__ == '__main__':
    app.run(debug= True)
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <h1> Home Page! </h1>
</body>
</html>

当我把放到safari中时,我会看到一个以

jinja2.exceptions.TemplateNotFound

我刚刚成功地在本地执行了您的代码,请仔细检查您的文件结构,它必须是:

/flaskblog.py
/templates
    /home.html

你的文件夹结构是什么?home.html文件是否在
templates
文件夹中?是的,它在文件夹中@luigibertacoHi@MustafaAlbairmani很高兴能帮忙。如果答案有帮助,您可以将其标记为正确的解决方案,以帮助具有相同问题的其他用户。
/flaskblog.py
/templates
    /home.html