Django + Pyinstaller模板不存在

时间:2017-12-20 05:04:08

标签: python django python-3.x pyinstaller

我正在使用pyinstaller从Django项目生成可执行文件。当我运行脚本生成可执行文件时,但当我从cmd运行EXE时,它显示如下错误:

  • 我检查了Django项目文件中的设置等文件。
  • 当我在Django默认服务器上运行时,模板正常加载。
  • 我看过很多类似的问题。但我找不到任何好的答案。

错误:

Django version 1.9.13, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
static
C:\Dev\EXE\cookie\dist\mysite\media
http
('Unexpected error:', <class 'django.template.exceptions.TemplateDoesNotExist'>

Traceback (most recent call last):
  File "crumbs_mysite\views.py", line 278, in parser
  File "crumbs_mysite\views.py", line 146, in licensevalidation
  File "site-packages\django\shortcuts.py", line 39, in render_to_response
  File "site-packages\django\template\loader.py", line 96, in render_to_string
  File "site-packages\django\template\loader.py", line 43, in get_template
django.template.exceptions.TemplateDoesNotExist: activate_license.html

Traceback (most recent call last):
  File "crumbs_mysite\views.py", line 278, in parser
  File "crumbs_mysiite\views.py", line 146, in licensevalidation
  File "site-packages\django\shortcuts.py", line 39, in render_to_response
  File "site-packages\django\template\loader.py", line 96, in render_to_string
  File "site-packages\django\template\loader.py", line 43, in get_template
django.template.exceptions.TemplateDoesNotExist: activate_license.html
[20/Dec/2017 10:21:09] "GET / HTTP/1.1" 500 27

1 个答案:

答案 0 :(得分:0)

我建议在pyinstaller上发布这个。您是否尝试通过spec文件手动添加Django库?