在Windows下使用fastcgi和Apache部署flask应用程序

在Windows下使用fastcgi和Apache部署flask应用程序,apache,python-2.7,flask,fastcgi,Apache,Python 2.7,Flask,Fastcgi,我正在尝试使用fastcgi在apache上部署我的flask应用程序 操作系统:Windows 10 python 2.7 apache路径:E:\development\webservices\apache\bin\httpd.exe Python路径:C:\Python27\Python.exe 我使用mod mod_fcgid 2.3.9运行fastcgi(E:\development\webservices\apache\modules\mod_fcgid.so) 我的fastcgi配

我正在尝试使用fastcgi在apache上部署我的flask应用程序

操作系统:Windows 10 python 2.7

apache路径:E:\development\webservices\apache\bin\httpd.exe

Python路径:C:\Python27\Python.exe

我使用mod mod_fcgid 2.3.9运行fastcgi(E:\development\webservices\apache\modules\mod_fcgid.so)

我的fastcgi配置文件(E:\development\webservices\apache\conf\extra\httpd fastcgi.conf)

我的httpd-vhosts.conf:

<VirtualHost *:5000>
    ServerName localhost:5000
    DocumentRoot c:/myproject/app
    ScriptAlias / c:/myproject/app/runserver.fcgi/

<Directory "c:/myproject/app/">
   AllowOverride None
   Allow from all
   Options +ExecCGI
   AddHandler fcgid-script .fcgi
   Require all granted
</Directory>

</VirtualHost>
runserver.fcgi内容:

#!C:/Python27/python.exe
# -*- coding: utf-8 -*-
import os
from flup.server.fcgi import WSGIServer
from image_hosting import app

if __name__ == '__main__':
    WSGIServer(app).run()
当我试图访问localhost:5000时,我得到500内部服务器错误

Apache错误日志:

AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::680d:ad2a:63e8:99bd. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 18 12:36:20.405465 2016] [mpm_winnt:notice] [pid 20032:tid 668] AH00455: Apache/2.4.20 (Win64) mod_fcgid/2.3.9 configured -- resuming normal operations
[Mon Apr 18 12:36:20.405465 2016] [mpm_winnt:notice] [pid 20032:tid 668] AH00456: Apache Lounge VC14 Server built: Apr  5 2016 13:15:28
[Mon Apr 18 12:36:20.405465 2016] [core:notice] [pid 20032:tid 668] AH00094: Command line: 'E:\\development\\webservices\\apache\\bin\\httpd.exe -d E:/development/webservices/apache'
[Mon Apr 18 12:36:20.406460 2016] [mpm_winnt:notice] [pid 20032:tid 668] AH00418: Parent: Created child process 3788
AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::680d:ad2a:63e8:99bd. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::680d:ad2a:63e8:99bd. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 18 12:36:20.702847 2016] [mpm_winnt:notice] [pid 3788:tid 648] AH00354: Child: Starting 64 worker threads.
[Mon Apr 18 12:36:21.444860 2016] [mpm_winnt:notice] [pid 7552:tid 652] AH00364: Child: All worker threads have exited.
[Mon Apr 18 12:36:28.178274 2016] [fcgid:warn] [pid 3788:tid 1172] (OS 109)The pipe has been ended.  : [client ::1:56818] mod_fcgid: get overlap result error
[Mon Apr 18 12:36:28.178274 2016] [core:error] [pid 3788:tid 1172] [client ::1:56818] End of script output before headers: runserver.fcgi

谁能给我解释一下,问题出在哪里?我该如何解决它?

显然,flup不支持Windows。我真是太傻了

app\
    runserver.py
    runserver.fcgi
    gallery\
    image_hosting\
                   images\
                   static\
                           css\
                           jmg\
                           js\
                   templates\
                   init.py
                   forms.py
                   models.py
                   routes.py
#!C:/Python27/python.exe
# -*- coding: utf-8 -*-
import os
from flup.server.fcgi import WSGIServer
from image_hosting import app

if __name__ == '__main__':
    WSGIServer(app).run()
AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::680d:ad2a:63e8:99bd. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 18 12:36:20.405465 2016] [mpm_winnt:notice] [pid 20032:tid 668] AH00455: Apache/2.4.20 (Win64) mod_fcgid/2.3.9 configured -- resuming normal operations
[Mon Apr 18 12:36:20.405465 2016] [mpm_winnt:notice] [pid 20032:tid 668] AH00456: Apache Lounge VC14 Server built: Apr  5 2016 13:15:28
[Mon Apr 18 12:36:20.405465 2016] [core:notice] [pid 20032:tid 668] AH00094: Command line: 'E:\\development\\webservices\\apache\\bin\\httpd.exe -d E:/development/webservices/apache'
[Mon Apr 18 12:36:20.406460 2016] [mpm_winnt:notice] [pid 20032:tid 668] AH00418: Parent: Created child process 3788
AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::680d:ad2a:63e8:99bd. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::680d:ad2a:63e8:99bd. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 18 12:36:20.702847 2016] [mpm_winnt:notice] [pid 3788:tid 648] AH00354: Child: Starting 64 worker threads.
[Mon Apr 18 12:36:21.444860 2016] [mpm_winnt:notice] [pid 7552:tid 652] AH00364: Child: All worker threads have exited.
[Mon Apr 18 12:36:28.178274 2016] [fcgid:warn] [pid 3788:tid 1172] (OS 109)The pipe has been ended.  : [client ::1:56818] mod_fcgid: get overlap result error
[Mon Apr 18 12:36:28.178274 2016] [core:error] [pid 3788:tid 1172] [client ::1:56818] End of script output before headers: runserver.fcgi