0

after trying to render index.html file in python it comes up with the jinja2.exceptions.TemplateNotFound: index.html error. The files are saved like this:

flaskTest/
    flaskTest.py
    templates/
        index.html

the code is also very simple and works without the template_render function:

from flask import Flask, redirect, url_for, render_template

app = Flask(__name__)

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

if __name__ == "__main__":
    app.run()

The only thing I can think of is that my environmental variables are somehow set wrong - I had issues with them whilst installing flask, but I can't see why they would affect this. Why will flask not find the html file?

also, I know this question is similar to others (specifically the one asked by Martijn Pieters), but I've tried the solutions suggested and it still doesn't work (in Martijn Pieters question it says to put the html file in a templates folder which I've done).

0 Answers0