-3
  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
  • 1,048,767
  • 296
  • 4,058
  • 3,343
kaio
  • 89
  • 1
  • 2
  • 6
  • Just the traceback tells us absolutely nothing. What code are you using? Where are the files located? What does your directory setup look like? – Martijn Pieters Apr 05 '15 at 15:06
  • 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() And hello.html: Hello Hello – kaio Apr 05 '15 at 15:22
  • So where is `app.py` located? Where is the `hello.html` file located? – Martijn Pieters Apr 05 '15 at 15:25
  • I have an App folder in which I created a static folder that contains the .css style and template folder with which I put hello.html and the mother "App" record it there's app.py – kaio Apr 05 '15 at 15:29
  • The template folder does not go inside the static folder. It goes **next** to the static folder and `app.py`. – Martijn Pieters Apr 05 '15 at 15:30
  • @MartijnPieters template folder doses not in static folder ,it is in APP folder and also static folder in App folder. – kaio Apr 05 '15 at 15:34

1 Answers1

4

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')
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343