2017-01-05 74 views
2

安装了Django 1.10.4,并通过名称test_py启动了一个项目。之后,通过名称test_app1创建了一个应用程序。AttributeError:'设置'对象没有属性'TEMPLATE_CONTEXT_PROCESSORS'

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

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

$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) 

回答

1

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

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

+0

是的,它与1.8.15 – arasub

相关问题