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

Website not working. When i open the website and it gives an error

Open RandomKidWhoIsLearningPython opened this issue 2 years ago • 3 comments

http://127.0.0.1:5000/login?next=%2F

it says

template not found

File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\app.py", line 2548, in call return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\app.py", line 2528, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\app.py", line 2525, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\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\user\PycharmProjects\pythonProject18\website\auth.py", line 28, in login return render_template("login.html", user=current_user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\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\user\PycharmProjects\pythonProject18\venv\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\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\jinja2\environment.py", line 1010, in get_template return self._load_template(name, globals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\jinja2\environment.py", line 969, in _load_template template = self.loader.load(self, name, self.make_globals(globals)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\jinja2\loaders.py", line 126, in load source, filename, uptodate = self.get_source(environment, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\templating.py", line 62, in get_source return self._get_source_fast(environment, template) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\pythonProject18\venv\Lib\site-packages\flask\templating.py", line 98, in _get_source_fast raise TemplateNotFound(template) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ jinja2.exceptions.TemplateNotFound: login.html The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame dump(obj) dumps all that's known about the object

following

Alex1sCC avatar Jan 20 '23 05:01 Alex1sCC

following, as i am also getting this error message.

kperez84 avatar Jan 24 '23 14:01 kperez84

just to be sure, are you sure you're directory structure is the same as in the video? also, post the auth.py code for reference the directory should look something like this, image

AusafMo avatar Mar 07 '23 20:03 AusafMo