【问题标题】:Flask Setup on IIS 8 on Windows Server 2012Windows Server 2012 上 IIS 8 上的 Flask 设置
【发布时间】:2025-12-02 02:10:01
【问题描述】:

我正在尝试在 Windows Server 2012 上托管 Flask Web 应用程序。 我已按照http://developer.e-power.com.kh/publish-flask-on-iis/ 中的说明进行操作 起初它不起作用,但启用 HTTP 激活 Windows 功能后,我在浏览 http://localhost:80/ 后得到以下错误消息:

Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 711, in main env, handler = read_wsgi_handler(response.physical_path) 
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 568, in read_wsgi_handler return env, get_wsgi_handler(handler_name) 
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 551, in get_wsgi_handler raise ValueError('"%s" could not be imported' % handler_name) 
ValueError: "app.app" could not be imported 
StdOut: 
StdErr: 

按照上面链接中的说明自动生成的web.config文件是:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="FlaskHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python27\python.exe|c:\inetpub\wwwroot\convnet\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
        </handlers>
    </system.webServer>
</configuration>

【问题讨论】:

    标签: azure iis flask server fastcgi


    【解决方案1】:

    确保您有可从 app.py 导入的 app 对象。好像没找到:

    ValueError: "app.app" could not be imported 
    

    【讨论】:

    • 您能详细说明一下吗?
    最近更新 更多