Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

TemplateNotFound jinja2.exceptions.TemplateNotFound: login.html

this the error which is occurring after the code is converted to exe file

the error exception
the code

Traceback (most recent call last):
  File "flask\app.py", line 2213, in _call_
  File "flask\app.py", line 2193, in wsgi_app
  File "flask\app.py", line 2190, in wsgi_app
  File "flask\app.py", line 1486, in full_dispatch_request
  File "flask\app.py", line 1484, in full_dispatch_request
  File "flask\app.py", line 1469, in dispatch_request
  File "app.py", line 122, in login
  File "flask\templating.py", line 150, in render_template
  File "jinja2\environment.py", line 1081, in get_or_select_template
  File "jinja2\environment.py", line 1010, in get_template
  File "jinja2\environment.py", line 969, in _load_template
  File "jinja2\loaders.py", line 126, in load
  File "flask\templating.py", line 64, in get_source
  File "flask\templating.py", line 98, in _get_source_fast
jinja2.exceptions.TemplateNotFound: login.html

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try using the --add-data flag to your pyinstaller command with the path to the templates folder as the argument.

For example:

pyinstaller --onefile --add-data "./templates;./templates" app.py

Use : as the path separator if you are using linux of mac.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading