TemplateError

iivri.andre at gmail.com iivri.andre at gmail.com
Mon Nov 21 01:22:53 EST 2016


THIS error is constantly showing up when I run my python script 
 eloiim:build iivri.andre$ python run.py 
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2016-11-21 01:15:26,561] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "run.py", line 10, in IsSelf
    return render_template('index.html', author=author, name=name)
  File "/usr/local/lib/python2.7/site-packages/flask/templating.py", line 133, in render_template
    return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 851, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 812, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 774, in _load_template
    cache_key = self.loader.get_source(self, name)[1]
  File "/usr/local/lib/python2.7/site-packages/flask/templating.py", line 57, in get_source
    return self._get_source_fast(environment, template)
  File "/usr/local/lib/python2.7/site-packages/flask/templating.py", line 85, in _get_source_fast
    raise TemplateNotFound(template)
TemplateNotFound: index.html

THIS is the code 

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

@app.route('/')
# THE @ is a decorator that is used to 'augment' function definitions
# Flask uses 'route()' to indicate that if the browser requests the address '/' (the default | home address), then our app shoud 'route' that request to this 'IsSelf' function
def IsSelf() :
    author = "raphael James "
    name = "Jaden iivii"
    return render_template('index.html', author=author, name=name)

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


How do I fix this? 



More information about the Python-list mailing list