Solutions of “jinja2.exceptions.TemplateNotFound: index.html”

While runing FLASK_APP=app.py FLASK_DEBUG=true flask run in the command line, sometimes you may see a TemplateNotFound Exception e.g. “jinja2.exceptions.TemplateNotFound: index”. Here is a step-by-step guide that will walk you through how you may have this issue resolved.

The error message was due to the lack of a “index.html” file in the “Template” directory. To resolve the issue, simply create a folder name it “Templates”. Then move “index.html” into this newly created folder.

Besides, in file “app.py”, revisions need to be made so that it reads something like this:

app=Flask(__name__,template_folder='templates')

Save this. Flask runs again and there wouldn’t be any error this time!




Sites DOT MIISThe Middlebury Institute site network.