Django+Pyinstaller模板不存在

2024-06-10 04:30:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用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

Tags: todjangoinpypackageslinesitetemplate