2017-01-05 97 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

相關問題