0

I am trying to render the file indexpy.html. The file exists in my project and in its folder, but I keep getting jinja2.exceptions.TemplateNotFound: home.html when I try to render it. Why can't Flask find my template?

from flask import Flask, redirect, url_for, render_template

app = Flask(__name__)


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

@app.route("/<name>")
  def user(name):
  return f"Hello {name}!"

@app.route("/admin")
  def admin():
  return redirect(url_for("home"))

if __name__ == "__main__":
  app.run()enter code here
S_C_P
  • 11
  • `The file exists in my project and in its folder,`: Templates have to be in a folder called `templates`, is that how you have it? – ilias-sp Feb 05 '22 at 19:49
  • you have to create a folder called ```templates```. So, you can put your html files ONLY. For other files such as ```css```, ```js```, or ```php```, you must another folder called ```services```. Make just that the folder is in the same directory as the script. – Andrew Hernandez Feb 05 '22 at 19:52

0 Answers0