-1

I know a similar question has been asked before but the answers were not able to help me. I am following this tutorial: https://www.youtube.com/watch?v=zRwy8gtgJ1A but i am unable to retrieve the template 'home.html' as I get the error
jinja2.exceptions.TemplateNotFound: home.html
I have ensured I have the right directory. As inside the folders I have my program (App.py) as well as a folder called 'Templates' and inside that I have my 'home.html' I have tried changing the capital letters. Recreating the folder. Tried following the tutorial again but no luck what so ever. I would be really happy if you could help me.
If you have any questions then feel free to hit me up:
p.s my code is :

from flask import Flask, render_template
app = Flask(__name__)

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


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

My dictionary is like this:

Program/
  app.py<br>
  Templates/
     home.html

1 Answers1

0
from flask import Flask, render_template
app = Flask(__name__, template_folder='./Templates')

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


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

You can force Flask to look for templates from the Templates folder by passing the directory as a parameter when you create the app