Reputation: 175
I am trying to make a distributable of a flask application. Everything works fine when running locally. When an executable is generated with pyinstaller it gives me the error:
Traceback (most recent call last):
File "site-packages\flask\app.py", line 2446, in wsgi_app
File "site-packages\flask\app.py", line 1951, in full_dispatch_request
File "site-packages\flask\app.py", line 1820, in handle_user_exception
File "site-packages\flask\_compat.py", line 39, in reraise
File "site-packages\flask\app.py", line 1949, in full_dispatch_request
File "site-packages\flask\app.py", line 1935, in dispatch_request
File "app.py", line 39, in index
File "site-packages\flask\templating.py", line 140, in render_template
File "site-packages\flask\templating.py", line 120, in _render
jinja2.exceptions.TemplateNotFound: bootstrap/base.html
I am using the flask bootstrap as shown here.
Upvotes: 1
Views: 941
Reputation: 21
create a new python file named 'hook-flask_bootstrap.py', inside of this paste the following:
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('flask_bootstrap')
Now when you run pyinstaller provide the path to this 'hook-flask_bootstrap.py' file:
--additional-hooks-dir=PATH (If relative path, just use .)
Upvotes: 2