Python Django部署-在fastCGI应用程序配置中找不到scriptProcessor

Python Django部署-在fastCGI应用程序配置中找不到scriptProcessor,python,django,iis,web-deployment,Python,Django,Iis,Web Deployment,我正在学习通过IIS和fastCGI部署Django项目的过程。但是,我遇到一个错误,在应用程序配置中找不到scriptProcessor 经过一点研究,我发现这个错误可能是由于配股问题。因此,我在Python37文件夹(包含python虚拟环境)中为用户DefaultAppPool添加了权限(读、写、执行),类似地,我在C:\inetpub上为文件夹wwwroot添加了权限 Python虚拟环境:C:\python37 Web.config文件路径:C:\inetpub\wwwroot\Web

我正在学习通过IIS和fastCGI部署Django项目的过程。但是,我遇到一个错误,在应用程序配置中找不到scriptProcessor

经过一点研究,我发现这个错误可能是由于配股问题。因此,我在Python37文件夹(包含python虚拟环境)中为用户
DefaultAppPool
添加了权限(读、写、执行),类似地,我在
C:\inetpub
上为文件夹wwwroot添加了权限

Python虚拟环境:
C:\python37
Web.config文件路径:
C:\inetpub\wwwroot\Web.config

Web.config

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

  <appSettings>
    <add key="PYTHONPATH" value="c:\python37\scripts\python.exe" />
    <add key="WSGI_HANDLER" value="manhour_site.wsgi.application" />
    <add key="DJANGO_SETTINGS_MODULE" value="manhour_site.settings" />
  </appSettings>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="fastCGI" 
      path="*" 
      verb="*" 
      modules="FastCgiModule" 
      scriptProcessor="c:\python37\scripts\python.exe|c:\python37\lib\site-packages\wfastcgi.py" 
      resourceType="Unspecified" 
      requireAccess="Script" />
    </handlers>

     <httpPlatform processPath="c:\python37\scripts\python.exe"
                  arguments="C:\inetpub\wwwroot\manhour_site\manage.py --port %HTTP_PLATFORM_PORT%"
                  stdoutLogEnabled="true"
                  stdoutLogFile="c:\home\LogFiles\python.log"
                  startupTimeLimit="60"
                  processesPerApplication="16">
      <environmentVariables>
        <environmentVariable name="SERVER_PORT" value="80" />
      </environmentVariables>

  </system.webServer>

  <appSettings>
    <add key="PYTHONPATH" value="c:\python37\scripts\python.exe" />
    <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
    <add key="DJANGO_SETTINGS_MODULE" value="manhour_site.settings" />
  </appSettings>
</configuration>
我以管理员身份运行了该命令
wfastcgienable

我需要一个可以指出错误并帮助解决此错误的解决方案

PS:在我的settings.py文件中,我更改了以下内容

       <fastCgi>
            <application fullPath="c:\python37\scripts\python.exe" arguments="c:\python37\lib\site-packages\wfastcgi.py" maxInstances="4" signalBeforeTerminateSeconds="30">
                <environmentVariables>
                    <environmentVariable name="DJANGO_SETTINGS_MODULE" value="manhour_site.settings" />
                    <environmentVariable name="PYTHONPATH" value="c:\python37\scripts\python.exe" />
                    <environmentVariable name="WSGI_HANDLER" value="manhour_site.wsgi.application" />
                </environmentVariables>
            </application>
       </fastCgi>
DEBUG = 'False'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
编辑 我已经将
HttpPlatformHandler
添加到
web.config

web.config

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

  <appSettings>
    <add key="PYTHONPATH" value="c:\python37\scripts\python.exe" />
    <add key="WSGI_HANDLER" value="manhour_site.wsgi.application" />
    <add key="DJANGO_SETTINGS_MODULE" value="manhour_site.settings" />
  </appSettings>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="fastCGI" 
      path="*" 
      verb="*" 
      modules="FastCgiModule" 
      scriptProcessor="c:\python37\scripts\python.exe|c:\python37\lib\site-packages\wfastcgi.py" 
      resourceType="Unspecified" 
      requireAccess="Script" />
    </handlers>

     <httpPlatform processPath="c:\python37\scripts\python.exe"
                  arguments="C:\inetpub\wwwroot\manhour_site\manage.py --port %HTTP_PLATFORM_PORT%"
                  stdoutLogEnabled="true"
                  stdoutLogFile="c:\home\LogFiles\python.log"
                  startupTimeLimit="60"
                  processesPerApplication="16">
      <environmentVariables>
        <environmentVariable name="SERVER_PORT" value="80" />
      </environmentVariables>

  </system.webServer>

  <appSettings>
    <add key="PYTHONPATH" value="c:\python37\scripts\python.exe" />
    <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
    <add key="DJANGO_SETTINGS_MODULE" value="manhour_site.settings" />
  </appSettings>
</configuration>

上述更改导致错误
无法访问请求的页面,因为页面的相关配置数据无效。


配置文件
\\?\C:\inetpub\wwwroot\web.Config

Microsoft建议使用HttpPlatformHandler@LexLi我对
web.Config
进行了更改,但仍然收到错误。它是HttpPlatformHandler或FastCGI,因此,您不能将两者都保留在配置中。我保留了FastCGI,并且我收到了一个错误
python.exe-FastCGI进程意外退出
是否可能是因为我使用的是python venv。有关“为IIS配置python web应用程序”的信息,您可以参考以下链接: