I am trying to render the file home.html
. The file exists in my project, but I keep getting jinja2.exceptions.TemplateNotFound: home.html
when I t
I think Flask uses the directory templates by default. So your code should be suppose this is your hello.py
from flask import Flask,render_template
app=Flask(__name__,template_folder='template')
@app.route("/")
def home():
return render_template('home.html')
@app.route("/about/")
def about():
return render_template('about.html')
if __name__=="__main__":
app.run(debug=True)
And you work space structure like
project/
hello.py
template/
home.html
about.html
static/
js/
main.js
css/
main.css
also you have create two html files with name of home.html and about.html and put those files in template folder.