Flask-Web-App-Tutorial icon indicating copy to clipboard operation
Flask-Web-App-Tutorial copied to clipboard

jinja2.exceptions.TemplateNotFound: home.html

Open Ainsleyem opened this issue 2 years ago • 3 comments

File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2548, in call return self.wsgi_app(environ, start_response) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2528, in wsgi_app response = self.handle_exception(e) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2525, in wsgi_app response = self.full_dispatch_request() File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "c:\Users\Emens\OneDrive\python website\website\templates\views.py", line 9, in home return render_template("home.html") File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\templating.py", line 146, in render_template template = app.jinja_env.get_or_select_template(template_name_or_list) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\jinja2\environment.py", line 1081, in get_or_select_template return self.get_template(template_name_or_list, parent, globals) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\jinja2\environment.py", line 1010, in get_template return self._load_template(name, globals) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\jinja2\environment.py", line 969, in _load_template template = self.loader.load(self, name, self.make_globals(globals)) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\jinja2\loaders.py", line 126, in load source, filename, uptodate = self.get_source(environment, name) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\templating.py", line 62, in get_source return self._get_source_fast(environment, template) File "C:\Users\Emens\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\templating.py", line 98, in _get_source_fast raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: home.html.

how do I fix this?

Ainsleyem avatar Sep 27 '22 17:09 Ainsleyem

What's the name of your folder in which the home.html file is located?

notaryanramani avatar Oct 05 '22 10:10 notaryanramani

What's the name of your folder in which the home.html file is located?

It is located in a "templates" folder

Ainsleyem avatar Oct 17 '22 21:10 Ainsleyem

I had the same error and it happened because my folder was named "template" instead of "templates"

mattmdjaga avatar Feb 02 '23 12:02 mattmdjaga