I am facing this issue: jinja2.exceptions.TemplateNotFound: templates/index.html
Although I have made templates folder and put index.html in it, but still I am getting this issue.
My directory structure:
/App
/templates
index.html
App.py
App.py looks like:
from flask import Flask, request, render_template
app = Flask(__name__, template_folder = 'templates')
@app.route("/")
def home():
return render_template("templates/index.html")
if __name__ == "__main__":
app.run()
If I make return statement in home() like this:
return "Hello World!"
It works fine.
Any help would be appreciated!
CodePudding user response:
Try this:
return render_template("index.html")