error TemplateNotFound: hello.html from flask

kaio
  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~
Martijn Pieters

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Flask raises TemplateNotFound error even though template file exists

From Dev

TemplateNotFound error Flask using render_template on Pythonanywhere

From Dev

Python: Hello world with Flask gives me an error related to app.run(debug=True)

From Dev

Error rendering html template with Flask and Google Colab

From Dev

'from flask import Flask' throws up a syntax error - Python

From Dev

Generating an HTML code from a flask server

From Dev

Passing dynamic value from HTML to Python Flask

From Dev

Generating an HTML code from a flask server

From Dev

Flask error after redirect from POST method

From Dev

Metaclass error from Flask-MongoKit

From Dev

python flask "from package.module" error

From Dev

Error displaying a variable from Flask into javascript code

From Dev

Flask error after redirect from POST method

From Dev

flask render_template not working with anchor tag # - jinja2.exceptions.TemplateNotFound

From Dev

flask render_template not working with anchor tag # - jinja2.exceptions.TemplateNotFound

From Dev

Java - Hello World Error

From Dev

Hello World in EmberJs Error

From Dev

Java - Hello World Error

From Dev

Flask and HTML, from python dictionary to HTML table iteratively

From Dev

flask html js css img reference 404 error

From Dev

flask html js css img reference 404 error

From Dev

Django assert failure: assertInHTML('hello', '<html>hello</html>')

From Dev

Knit HTML - Recover from Error?

From Dev

GWan Hello.c error

From Dev

Hello World throwing error in Java

From Dev

UEFI hello world compile error

From Dev

Spring hello world example error

From Dev

GWan Hello.c error

From Dev

Hello World not printing. Error

Related Related

HotTag

Archive