File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 64, in get_source
raise TemplateNotFound(template)
TemplateNotFound: hello.html
script of app.py:
from flask import Flask
from flask import request
from flask import render_template
APP = Flask(_name__)
@APP.route('/')
def hello():
return render_template('hello.html')
if _name__ == '_main__':
APP.debug=True
APP.run()
My directory structure:
app/
├── app.py
├── app.py~
├── static
│ └── style.css
└── template
├── hello.html
└── hello.html~
The default template directory name is templates
, plural. You are missing the s
at the end.
Alternatively, tell Flask to look at the different directory name:
APP = Flask(_name__, template_folder='template')
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments