在使用IIS在Windows Server 2012上部署Django应用程序时,为什么经常出现“FastCGI进程失败”的问题?

8

输入图像描述我正在尝试使用IIS在Windows 2012服务器上部署Django应用程序。 我的web.config文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
           
            <add name="Django Handler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\chinmay_arima\env_resolution\Scripts\python.exe|C:\Users\chinmay_arima\env_resolution\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
      
    </handlers>
    </system.webServer>
</configuration>

出现“HTTP错误500 - 内部服务器错误”。

请查看附件以查看错误。

  • Django版本:2
  • IIS版本:8.5

我正在按照以下链接进行操作: http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html

1个回答

0

我认为这个错误是由于您的 web.config 文件放置不当引起的。此外,在 appSettings 下似乎缺少一些参数。

您的配置文件应该像这样 https://github.com/Johnnyboycurtis/webproject/blob/master/web-config-template

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
    <handlers>
    <add name="Python FastCGI" 
    path="*" 
    verb="*" 
    modules="FastCgiModule" 
    scriptProcessor="<to be filled in>" 
    resourceType="Unspecified" 
    requireAccess="Script" />
    </handlers>
</system.webServer>

<appSettings>
    <add key="PYTHONPATH" value="C:\inetpub\wwwroot\webproject" />
    <add key="WSGI_HANDLER" value="webproject.wsgi.application" />
    <add key="DJANGO_SETTINGS_MODULE" value="webproject.settings" />
</appSettings>
</configuration>

这里有一个教程,可以跟着这个代码项目学习在Windows上使用Microsoft IIS部署Django


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接