猿问

django on IIS winserver 2016 wfastcgi handler

在Windows Server 2016上安装了python 3.8.1,django 3.0.3,wfastcgi和iam收到此错误,找不到任何修复它的东西。


在python安装文件夹上给了IIS AppPool\DefaultAppPool读取和使用权限,但它仍然不起作用,不知何故处理程序无法读取它,但据我所知,配置似乎是正确的。希望你能帮助我。谢谢。


C:\inetpub\wwwroot -> web.conf


<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

        <handlers>

            <add name="Python FastCGI"

                path="*"

                verb="*"

                modules="FastCgiModule"

                scriptProcessor="c:\users\administrator\python38\python.exe|c:\users\administrator\python38\lib\site-packages\wfastcgi.py"

                resourceType="Unspecified"

                requireAccess="Script" />

        </handlers>

    </system.webServer>


    <appSettings>

        <!-- Required settings --> 

        <add key="WSGI_HANDLER" value="web.wsgi.application" />

        <add key="PYTHONPATH" value="C:\inetpub\wwwroot\AddressLizenzbuch" />


        <!-- Optional settings -->


        <add key="DJANGO_SETTINGS_MODULE" value="web.settings" />


    </appSettings>

</configuration>

C:\inetpub\wwwroot\AddressLizenzbuch\web\blog\static -> web.config


<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

        <!-- Overrides the FastCGI handler to let IIS serve the static files -->

        <handlers>

            <clear/>

            <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

        </handlers>

    </system.webServer>

</configuration>

manage.py


#!/usr/bin/env python

"""Django's command-line utility for administrative tasks."""

import os

import sys



万千封印
浏览 205回答 1
1回答

精慕HU

这应该是一个简单的解决方法。你的 Django 项目是以下结构C:/inetpub/wwwroot/AddressLizenzbuch/web/web跟。web.config问题是额外的目录 。删除它。AddressLizenzbuch您的目录应类似于 。C:/inetpub/wwwroot/web/web问题是 wfastcgi.py 正在寻找,但这条路显然不存在。您的配置文件应在删除非必要目录后包含此行C:/inetpub/wwwroot/AddressLizenzbuch/web/wsgi.pyAddressLizenzbuch<add&nbsp;key="PYTHONPATH"&nbsp;value="C:\inetpub\wwwroot\web"&nbsp;/>为了明确这一点,您的 wsgi.py 文件应位于C:\inetpub\wwwroot\web\web\wsgi.py如果您还有其他问题,请随时在GitHub上浏览此项目webproject
随时随地看视频慕课网APP

相关分类

Python
我要回答