【问题标题】:How to fix "AttributeError: module has no attribute 'wsgi' " in wfastcgi如何在 wfastcgi 中修复“AttributeError: module has no attribute 'wsgi'”
【发布时间】:2019-12-01 10:56:18
【问题描述】:

我尝试在IIS 10(Windows Server 2019)上设置我的django 2.2.2 项目“WebGUI”,但遗憾的是我无法让它工作。

WFastCGI 已安装并启用,我创建了一个 web.config 并在其中声明了一个 python FastCGI 处理程序。密钥应该是正确的,据我所知,这就是我应该配置的全部。

web.config:

<configuration>
 <system.webServer>
  <handlers>
   <add name="Python FastCGI"
    path="*"
    verb="*"
    modules="FastCgiModule"
    scriptProcessor="c:\python\python37-32\python.exe|c:\python\python37-32\lib\site-packages\wfastcgi.py"
    resourceType="Unspecified"
    requireAccess="Script" />
  </handlers>
 </system.webServer>


 <appSettings>
  <!--Required Settings-->
  <add key="WSGI_HANDLER" value="WebGUI.wsgi.application" />
  <add key="PYTHONPATH" value="C:\inetpub\wwwroot\WebGUI" />
  <add key="WSGI_LOG" value="d:\wfastcgi.log" />
  <add key="DJANGO_SETTINGS_MODULE" value="WebGUI.settings" />

 </appSettings>
</configuration>

我的 settings.py 说WSGI_APPLICATION = 'WebGUI.wsgi.application' 还有我的 wsgi.py:

from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'WebGUI.settings')
application = get_wsgi_application()

读取 WSGI 处理程序时发生错误:

Traceback (most recent call last): 
File "c:\python\python37-32\lib\site-packages\wfastcgi.py",line 791, 
in main env, handler = read_wsgi_handler(response.physical_path) 
File "c:\python\python37-32\lib\site-packages\wfastcgi.py", line 633, 
in read_wsgi_handler handler = get_wsgi_handler(os.getenv("WSGI_HANDLER")) 
File "c:\python\python37-32\lib\site-packages\wfastcgi.py", line 603, 
in get_wsgi_handler handler = getattr(handler, name) AttributeError: 
module 'WebGUI' has no attribute 'wsgi' StdOut: StdErr:

【问题讨论】:

    标签: python django iis wsgi wfastcgi


    【解决方案1】:

    解决了。 出于某种原因,我的项目文件夹中有一个 __ init__.py,这让 wfastcgi 感到困惑。

    【讨论】:

      猜你喜欢
      • 2022-12-01
      • 1970-01-01
      • 2023-02-17
      • 2022-08-04
      • 2015-09-26
      • 2020-11-23
      • 2022-08-24
      • 2014-12-20
      • 2021-12-12
      相关资源
      最近更新 更多