我正在尝试部署一个web.py应用程序,并在Windows上使用带有mod_fcgid的apache来执行此操作。我已根据web.py网站上的this指南设置了httpd.conf文件,但在尝试访问我的文件时仍遇到错误。
文件 - D:/Documents/dna_manip/start.py - 在访问localhost时运行,但不显示任何内容。错误日志给了我这两行
[Thu Aug 23 10:01:41.515773 2012] [fcgid:warn] [pid 19352:tid 1928] (OS 109)The pipe has been ended. : [client ::1:52670] mod_fcgid: get overlap result error
[Thu Aug 23 10:01:41.516773 2012] [core:error] [pid 19352:tid 1928] [client ::1:52670] End of script output before headers: start.py
我的httpd.conf包含有关mod_fcgid
的这些行SocketPath /tmp/fcgidsock
SharememPath /tmp/fcgid_shm
Alias /static "D:/Documents/dna_manip/static"
Alias / "D:/Documents/dna_manip/"
<Directory "D:/Documents/dna_manip/">
allow from all
SetHandler fcgid-script
Options +ExecCGI
AllowOverride None
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/icons
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^(/.*)+start.py/
RewriteRule ^(.*)$ start.py/$1 [PT]
</IfModule>
</Directory>
<Directory "D:/Documents/dna_manip/static/">
allow from all
AllowOverride None
Options -ExecCGI
SetHandler None
</Directory>
有没有人知道为什么这不起作用?
编辑:
我被要求提供一些python代码 - 在我的实际代码不起作用后,我开始尝试在web.py页面上使用hello world示例。这是我文件中运行的代码。
#!C:/Python27/python.exe
import web
urls = ("/.*", "hello")
app = web.application(urls, globals())
class hello:
def GET(self):
return "Hello"
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
if __name__ == "__main__":
app.run()