Python 属性错误:';设置';对象没有属性';模板&u上下文&u处理器&x27;

Python 属性错误:';设置';对象没有属性';模板&u上下文&u处理器&x27;,python,django,python-2.7,pyinstaller,Python,Django,Python 2.7,Pyinstaller,安装了Django 1.10.4并启动了一个名为test_py的项目。之后,创建了一个名为test_app1的应用程序 创建应用程序后,计划创建一个安装程序,将其作为标准应用程序运行 尝试使用Django 1.10.4和pyinstaller 3.2制作windows installer 执行下面的命令时出现错误,然后是控制台输出 $pyinstaller --name=test_py ../test_py/manage.py 131 INFO: PyInstaller: 3.2 131

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

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

尝试使用Django 1.10.4和pyinstaller 3.2制作windows installer 执行下面的命令时出现错误,然后是控制台输出

$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)  
$pyinstaller--name=test\u py../test\u py/manage.py
131信息:PyInstaller:3.2
131信息:Python:2.7.12
131信息:平台:Windows-7-6.1.7601-SP1
132信息:编写了C:\MAMP\htdocs\crumbles\test\u django\test\u py\u package\test\u py.spec
134信息:UPX不可用。
137信息:使用路径扩展PYTHONPATH
['C:\\MAMP\\htdocs\\crumbles\\test\u django\\test\u py',
'C:\\MAMP\\htdocs\\crumbles\\test\u django\\test\u py\u package']
137信息:检查分析
137信息:正在生成分析,因为不存在out00-Analysis.toc
137信息:正在初始化模块依赖关系图。。。
140信息:正在初始化模块图形挂钩。。。
203信息:运行分析out00-Analysis.toc
208信息:将Microsoft.VC90.CRT添加到最终可执行文件的相关程序集
c:\python27\python.exe所需
328信息:找到C:\Windows\WinSxS\Manifests\amd64\U policy.9.0.microsoft.vc90.crt\U 1FC8B3B9A118E3B\U 9.0.30729.1\U none\U 3da38fdebd0e6822.manifest
330信息:找到C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1FC8B3B9A118E3B_9.0.30729.4926_none_accf10dbe1dc8ba2.manifest
332信息:找到C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1FC8B3B9A118E3B_9.0.30729.4940_none_acd19a1fe1da248a.manifest
435信息:正在搜索程序集amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.4940_无。。。
435信息:找到清单C:\Windows\WinSxS\Manifests\amd64\u microsoft.vc90.crt\u 1fc8b3b9a1e18e3b\u 9.0.30729.4940\u无\u 08e4299fa83d7e3c.manifest
437信息:正在搜索文件msvcr90.dll
437信息:找到文件C:\Windows\WinSxS\amd64\U microsoft.vc90.crt\U 1fc8b3b9a1e18e3b\U 9.0.30729.4940\U none\U 08e4299fa83d7e3c\msvcr90.dll
437信息:正在搜索文件msvcp90.dll
437信息:找到文件C:\Windows\WinSxS\amd64\U microsoft.vc90.crt\U 1fc8b3b9a1e18e3b\U 9.0.30729.4940\U none\U 08e4299fa83d7e3c\msvcp90.dll
437信息:正在搜索文件msvcm90.dll
437信息:找到文件C:\Windows\WinSxS\amd64\U microsoft.vc90.crt\U 1fc8b3b9a1e18e3b\U 9.0.30729.4940\U none\U 08e4299fa83d7e3c\msvcm90.dll
545信息:找到C:\Windows\WinSxS\Manifests\amd64\U policy.9.0.microsoft.vc90.crt\U 1FC8B3B9A118E3B\U 9.0.30729.1\U none\U 3da38fdebd0e6822.manifest
546信息:找到C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1FC8B3B9A118E3B_9.0.30729.4926_none_accf10dbe1dc8ba2.manifest
547信息:找到C:\Windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1FC8B3B9A118E3B_9.0.30729.4940_none_acd19a1fe1da248a.manifest
548信息:添加重定向Microsoft.VC90.CRT版本(9,0,21022,8)->(9,0,30729,4940)
5515信息:缓存模块挂钩。。。
5520信息:分析C:\MAMP\htdocs\crumbles\test\u django\test\u py\manage.py
8648信息:处理预查找模块路径挂钩区
8905信息:正在处理预安全导入模块挂钩
12407信息:正在加载模块挂钩。。。
12407信息:加载模块挂钩“hook distutils.py”。。。
12407信息:正在加载模块挂钩“hook sysconfig.py”。。。
12407信息:加载模块hook“hook django.core.management.py”。。。
14320信息:不包括导入“IPython”
14322警告:正在从模块IPython中删除导入django.core.management.commands.shell
14322警告:正在从模块IPython.IPShell中删除import django.core.management.commands.shell
14322警告:正在从模块IPython.start\u IPython中删除import django.core.management.commands.shell
14323信息:未找到要排除的导入:“Tkinter”
14323信息:未找到要排除的导入:“matplotlib”
14324信息:加载模块钩子“hook xml.py”。。。
14324信息:加载模块hook“hook django.db.backends.py”。。。
15119信息:加载模块挂钩“hook-jinja2.py”。。。
15141信息:加载模块挂钩“hook httplib.py”。。。
15141信息:加载模块钩子“hook django.db.backends.oracle.base.py”。。。
15144信息:正在加载模块钩子“hook xml.dom.domreg.py”。。。
15144信息:加载模块hook“hook-pkg_resources.py”。。。
15457信息:加载模块钩子“hook django.db.backends.mysql.base.py”。。。
15459信息:加载模块钩子“hook django.core.mail.py”。。。
15537信息:加载模块挂钩“hook pytz.py”。。。
15617信息:加载模块钩子“hook encodings.py”。。。
16035信息:加载模块hook“hook-sqlite3.py”。。。
16040信息:加载模块钩子“hook django.py”。。。
16041信息:Django根目录C:\MAMP\htdocs\crumbles\test\u Django\test\u py\test\u py
回溯(最近一次呼叫最后一次):
文件“c:\python27\lib\site packages\PyInstaller\utils\hooks\subpc\django\u import\u finder.py”,第37行,在
列表(设置.模板加载程序)+\
文件“c:\python27\lib\site packages\django\conf\\ uuuuu init\uuuuu.py”,第54行,在__
返回getattr(自我包装,名称)
AttributeError:“设置”对象没有“模板\u上下文\u处理器”属性
17037信息:正在收集Django迁移脚本。
18081信息:加载模块钩子“hook django.core.cache.py”。。。
18119信息:加载模块挂钩“hook-psycopg2.py”。。。
18121警告:未找到隐藏的导入“mx.DateTime”!
18186信息:正在查找ctypes DLL
18203信息:正在分析运行时挂钩。。。
18215信息:包括运行时钩子“pyi_rth_django.py”
18217信息:包括运行时钩子'pyi_rth_pkgres.py'
18242信息:寻找动态库
32332信息:寻找鸡蛋
32332信息:使用Python库C:\Windows\system32\python27.dll
32332信息:找到绑定重定向:
[BindingRedirect(name=u'Microsoft.VC90.CRT',language=None,arch=u'amd64',旧版本=(9,0,21022,8),新版本=(9,0,30729,4940),publicKeyToken=u'1fc8b3b9ae18e3b')]
32357英寸
hiddenimports = list("settings.INSTALLED_APPS") + \
                 list("settings.TEMPLATE_CONTEXT_PROCESSORS") + \
                 list("settings.TEMPLATE_LOADERS") + \
                 ["settings.ROOT_URLCONF"]
hiddenimports = list(getattr(settings, "INSTALLED_APPS", [])) + \
                 list(getattr(settings, "TEMPLATE_CONTEXT_PROCESSORS", [])) + \
                 list(getattr(settings, "TEMPLATE_LOADERS", [])) + \
                 [getattr(settings, "ROOT_URLCONF", "")]