gpt4 book ai didi

python - 属性错误 : 'Settings' object has no attribute 'TEMPLATE_CONTEXT_PROCESSORS'

转载 作者:太空宇宙 更新时间:2023-11-04 02:59:11 26 4
gpt4 key购买 nike

安装了 Django 1.10.4 并启动了一个名为 test_py 的项目。之后创建了一个名为 test_app1 的应用。

在创建应用程序后,计划创建一个安装程序以将其作为标准独立应用程序运行。

尝试使用 Django 1.10.4 和 pyinstaller 3.2 制作 Windows 安装程序在执行以下命令时卡住错误,然后是控制台输出。

$pyinstaller --name=test_py ../test_py/manage.py

131 INFO: PyInstaller: 3.2
131 INFO: Python: 2.7.12
131 INFO: Platform: Windows-7-6.1.7601-SP1
132 INFO: wrote C:\MAMP\htdocs\crumbles\test_django\test_py_package\test_py.spec
134 INFO: UPX is not available.
137 INFO: Extending PYTHONPATH with paths
['C:\\MAMP\\htdocs\\crumbles\\test_django\\test_py',
'C:\\MAMP\\htdocs\\crumbles\\test_django\\test_py_package']
137 INFO: checking Analysis
137 INFO: Building Analysis because out00-Analysis.toc is non existent
137 INFO: Initializing module dependency graph...
140 INFO: Initializing module graph hooks...
203 INFO: running Analysis out00-Analysis.toc
208 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
required by c:\python27\python.exe
328 INFO: Found C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_3da38fdebd0e6822.manifest
330 INFO: Found C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_accf10dbe1dc8ba2.manifest
332 INFO: Found C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_acd19a1fe1da248a.manifest
435 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.4940_none ...
435 INFO: Found manifest C:\Windows\WinSxS\Manifests\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c.manifest
437 INFO: Searching for file msvcr90.dll
437 INFO: Found file C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c\msvcr90.dll
437 INFO: Searching for file msvcp90.dll
437 INFO: Found file C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c\msvcp90.dll
437 INFO: Searching for file msvcm90.dll
437 INFO: Found file C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c\msvcm90.dll
545 INFO: Found C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_3da38fdebd0e6822.manifest
546 INFO: Found C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_accf10dbe1dc8ba2.manifest
547 INFO: Found C:\Windows\WinSxS\Manifests \amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_acd19a1fe1da248a.manifest
548 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 4940)
5515 INFO: Caching module hooks...
5520 INFO: Analyzing C:\MAMP\htdocs\crumbles\test_django\test_py\manage.py
8648 INFO: Processing pre-find module path hook distutils
8905 INFO: Processing pre-safe import module hook _xmlplus
12407 INFO: Loading module hooks...
12407 INFO: Loading module hook "hook-distutils.py"...
12407 INFO: Loading module hook "hook-sysconfig.py"...
12407 INFO: Loading module hook "hook-django.core.management.py"...
14320 INFO: Excluding import 'IPython'
14322 WARNING: Removing import django.core.management.commands.shell from module IPython
14322 WARNING: Removing import django.core.management.commands.shell from module IPython.IPShell
14322 WARNING: Removing import django.core.management.commands.shell from module IPython.start_ipython
14323 INFO: Import to be excluded not found: 'Tkinter'
14323 INFO: Import to be excluded not found: 'matplotlib'
14324 INFO: Loading module hook "hook-xml.py"...
14324 INFO: Loading module hook "hook-django.db.backends.py"...
15119 INFO: Loading module hook "hook-jinja2.py"...
15141 INFO: Loading module hook "hook-httplib.py"...
15141 INFO: Loading module hook "hook-django.db.backends.oracle.base.py"...
15144 INFO: Loading module hook "hook-xml.dom.domreg.py"...
15144 INFO: Loading module hook "hook-pkg_resources.py"...
15457 INFO: Loading module hook "hook-django.db.backends.mysql.base.py"...
15459 INFO: Loading module hook "hook-django.core.mail.py"...
15537 INFO: Loading module hook "hook-pytz.py"...
15617 INFO: Loading module hook "hook-encodings.py"...
16035 INFO: Loading module hook "hook-sqlite3.py"...
16040 INFO: Loading module hook "hook-django.py"...
16041 INFO: Django root directory C:\MAMP\htdocs\crumbles\test_django\test_py\test_py
Traceback (most recent call last):
File "c:\python27\lib\site-packages\PyInstaller\utils\hooks\subproc\django_import_finder.py", line 37, in <module>
list(settings.TEMPLATE_LOADERS) + \
File "c:\python27\lib\site-packages\django\conf\__init__.py", line 54, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'TEMPLATE_CONTEXT_PROCESSORS'
17037 INFO: Collecting Django migration scripts.
18081 INFO: Loading module hook "hook-django.core.cache.py"...
18119 INFO: Loading module hook "hook-psycopg2.py"...
18121 WARNING: Hidden import "mx.DateTime" not found!
18186 INFO: Looking for ctypes DLLs
18203 INFO: Analyzing run-time hooks ...
18215 INFO: Including run-time hook 'pyi_rth_django.py'
18217 INFO: Including run-time hook 'pyi_rth_pkgres.py'
18242 INFO: Looking for dynamic libraries
32332 INFO: Looking for eggs
32332 INFO: Using Python library C:\Windows\system32\python27.dll
32332 INFO: Found binding redirects:
[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'amd64', oldVersion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 4940), publicKeyToken=u'1fc8b3b9a1e18e3b')]
32357 INFO: Warnings written to C:\MAMP\htdocs\crumbles\test_django\test_py_package\build\test_py\warntest_py.txt
33626 INFO: checking PYZ
33627 INFO: Building PYZ because out00-PYZ.toc is non existent
33627 INFO: Building PYZ (ZlibArchive) C:\MAMP\htdocs\crumbles\test_django\test_py_package\build\test_py\out00-PYZ.pyz
35328 INFO: checking PKG
35328 INFO: Building PKG because out00-PKG.toc is non existent
35328 INFO: Building PKG (CArchive) out00-PKG.pkg
35485 INFO: Bootloader c:\python27\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
35485 INFO: checking EXE
35486 INFO: Building EXE because out00-EXE.toc is non existent
35486 INFO: Building EXE from out00-EXE.toc
35486 INFO: Appending archive to EXE C:\MAMP\htdocs\crumbles\test_django\test_py_package\build\test_py\test_py.exe
35518 INFO: checking COLLECT
35518 INFO: Building COLLECT because out00-COLLECT.toc is non existent
35518 INFO: Building COLLECT out00-COLLECT.toc
35543 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 4940)

最佳答案

TEMPLATE_CONTEXT_PROCESSORS 设置在 Django 1.8 中已弃用,并在 Django 1.10 中删除。

看起来 pyinstaller 似乎不支持 Django 1.10(参见 this issue)。在修复之前,您可以使用 Django 1.8,这是一个 LTS(长期支持)版本。

关于python - 属性错误 : 'Settings' object has no attribute 'TEMPLATE_CONTEXT_PROCESSORS' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41487104/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com