flask+windows


  1. 配置好wfastcgi,将wfastcgi.py拷贝到项目根目录
  2. IIS添加项目网站
    1. 网站名称
    2. 物理路径(项目地址)
    3. 连接为(特定用户,输入用户密码)
    4. 端口
  3. 处理程序映射
    1. 点击“网站”中你的项目
    2. 点击右侧【处理程序映射】
    3. 在【处理程序映射】界面,右键【添加模块映射】编辑模块映射
      1. 请求路径:*
      2. 模块:FastCgiModule
      3. 可执行文件python位置|wfastcgi.py位置,如D:\python.exe|D:\connect\wfastcgi.py
      4. 请求限制,去掉映射下面的✔
      5. 确认添加模块
  4. FastCGI设置
    1. 主页(【网站】的上一级),进入【FastCGI设置】
    2. 双击刚才添加的FastCGI,【编辑FastCGI应用程序】
    3. 【环境变量】中添加
      1. PYTHONPATH :项目路径
      2. WSGI_HANDLER:启动文件.app 如app.app

附录:

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="FlaskFastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\python\soft\python.exe|D:\python\project\connect\wfastcgi.py" resourceType="Unspecified" />
        </handlers>
    </system.webServer>
    <system.web>
        <authentication mode="Windows" />
    </system.web>
</configuration>