jinja2.exceptions.TemplateNotFound 为什么这个一直弹出?

jinja2.exceptions.TemplateNotFound why does this keep popping up?

这是我的代码 pro.py,我保存在我的下载中:

 from flask import Flask, render_template, flash, session, redirect, url_for
    from flask_wtf import FlaskForm
    from wtforms import StringField,SubmitField

app = Flask(__name__)

app.config['SECRET_KEY'] = 'kmkey'

class SimpleForm(FlaskForm):

    breed = StringField('What breed are you?')
    submit= SubmitField('Click Me')

@app.route('/',methods=['GET','POST'])
def imp():

    form = SimpleForm()

    if form.validate_on_submit():
        session['breed'] = form.breed.data
        flash(f"You just changed your breed to: {session['breed']}")

        return redirect(url_for('imp'))

    return render_template('imp.html',form=form)

if __name__ == '__main__':
    app.run(debug=True)

这是我的 html 代码 imp.html,我保存在我的模板文件夹中,该文件夹位于下载中:

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
     {% for mess in get_flashed_messages() %}
     <div class="alert alert-warning alert-dismissible fade show" role='alert'>
        <button type="button" class="fade close" data-dismiss='alert' aria-label='close' >
          <span aria-hidden='true'>&times;</span>
        </button>
        {{mess}}
     </div>

    {% endfor %}

    <form method="post">
      {{form.hidden_tag()}}
      {{form.breed.label}}{{form.breed}}
      {{form.submit()}}
    </form>
  </body>
</html>

现在,当我 运行 我的 python 文件在网络上时,它会抛出一个错误提示 jinja2.exceptions.TemplateNotFound:imp.html为什么会这样??

谁能帮我解决这个问题。

您需要将其保存在 templates 文件夹中,而不是 template 文件夹中。