【发布时间】:2022-01-28 02:01:22
【问题描述】:
我想打开django项目的时候遇到这样的错误。我的 django 项目在同一台服务器上运行,但我在上次打开的站点上遇到了这样的错误。
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\python39\python.exe|c:\python39\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<tracing>
<traceFailedRequests>
<clear />
</traceFailedRequests>
</tracing>
</system.webServer>
<appSettings>
<add key="WSGI_HANDLER" value="umy.wsgi.application" />
<add key="DJANGO_SETTINGS_MODULE" value="umy.settings" />
<add key="PYTHONPATH" value="C:\Inetpub\vhosts\domain.com\httpdocs" />
</appSettings>
<system.web>
<compilation tempDirectory="C:\Inetpub\vhosts\domain.com\tmp" />
</system.web>
</configuration>
我得到的错误是关于;
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "c:\python39\lib\site-packages\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "c:\python39\lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "c:\python39\lib\site-packages\wfastcgi.py", line 616, in get_wsgi_handler
raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "umy.wsgi.application" could not be imported: Traceback (most recent call last):
File "c:\python39\lib\site-packages\wfastcgi.py", line 600, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File ".\umy\wsgi.py", line 9, in <module>
application = get_wsgi_application()
File "c:\python39\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "c:\python39\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "c:\python39\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "c:\python39\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "c:\python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'htmlmin'
StdOut:
StdErr:
对不起我的英语不好
【问题讨论】:
-
请在
settings.py中显示MIDDLEWARE列表 -
htmlmin 安装库后问题解决了。
-
如果我的回复有帮助,请采纳为答案(点击回复旁边的标记选项将其从灰色切换为填写。),请参阅meta.stackexchange.com/questions/5234/…
标签: python django iis webdeploy