I am trying to make a distributable 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
Some friends say:
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:
I use command line:
**pyinstaller -D --i icon\crawler_spider72.ico --additional-hooks-dir hook-flask_bootstrap.py run.py**
I searched for some answers, but after using, there was no action collected. Don't know where the mistake is. Ask the knowledgeable person for advice. Thank you