WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!

1,724 views
Skip to first unread message

大郎

unread,
Jun 17, 2009, 11:33:47 AM6/17/09
to we...@googlegroups.com
visit this url, I got 404:
File does not exist: /home/68886/domains/autopart.hi0791.com/html/test.py/


$ python test.py

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 404 Not Found
Content-Type: text/html
Content-Length: 9

how can I fix this problem? thanks.


# test.py
#!/usr/bin/env python
# coding: utf-8

import web

web.config.debug = True
urls = ('/', 'Index')

class Index:

    def GET(self):
        return 'this is a test web, bulid with webpy(webpy.org), version ' + web.__version__ + "OK"


if __name__ == "__main__":
    web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
    app = web.application(urls, globals())
    app.run()



# .htaccess
<Files test.py>
    SetHandler fastcgi-script
</Files>


<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/static
    RewriteCond %{REQUEST_URI} !^(/.*)+test.py/
    RewriteRule ^(.*)$ test.py/$1 [PT]
</IfModule>



--
百才招聘(baicai.com).产品部
Email: k...@baicai.com
Gtalk: qicha...@gmail.com
twitter.com/qichangxing

SeC

unread,
Jun 17, 2009, 12:31:25 PM6/17/09
to web.py
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func,
addr) - this force script to start in fastcgi mode, You can remove it,
it will start in fastcgi when invoked by proper deamon.
> Gtalk: qichangx...@gmail.com
> twitter.com/qichangxing

大郎

unread,
Jun 17, 2009, 9:36:18 PM6/17/09
to we...@googlegroups.com
2009/6/18 SeC <sec...@gmail.com>


web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func,
addr) - this force script to start in fastcgi mode, You can remove it,
it will start in fastcgi when invoked by proper deamon.


like this?

# test.py
if __name__ == "__main__":
    # web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)

    app = web.application(urls, globals())
    app.run()

and why that: http://webpy.org/cookbook/fastcgi-apache

--
百才招聘(baicai.com).产品部
Email: k...@baicai.com
Gtalk: qicha...@gmail.com
twitter.com/qichangxing

大郎

unread,
Jun 18, 2009, 9:12:15 PM6/18/09
to we...@googlegroups.com
2009/6/18 大郎 <qicha...@gmail.com>

# test.py

if __name__ == "__main__":
    # web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
    app = web.application(urls, globals())
    app.run()


$ python test.py
http://0.0.0.0:8080

it is ok, but visit the domain, it return 404.

大郎

unread,
Jun 20, 2009, 11:29:11 PM6/20/09
to we...@googlegroups.com
why I got 404?

# .htaccess:

AddHandler fcgid-script .py

<IfModule mod_rewrite.c>
    RewriteEngine on
    # RewriteCond %{REQUEST_URI} !^/static

    RewriteCond %{REQUEST_URI} !^(/.*)+test.py/
    RewriteRule ^(.*)$ test.py/$1 [PT]
</IfModule>

# error_log:


File does not exist: /home/68886/domains/autopart.hi0791.com/html/test.py/

qyb

unread,
Jun 21, 2009, 9:18:59 PM6/21/09
to we...@googlegroups.com
webpy 运行 fastcgi server 的话,是需要第三方程序来包装一下的,以控制起最大多少个连接,空闲线程数什么的。

mail.sohu.com 现在是用 ZDaemon 来作这个事情;webpy.org 上有一篇教程,描述用 lighttpd 的子项目
spawn-fcgi 来包装

参考 http://webpy.org/cookbook/fastcgi-nginx

我刚试了一下,fastcgi 是可以这样跑起来的

赵佶

unread,
Nov 23, 2013, 12:09:50 AM11/23/13
to we...@googlegroups.com
请问在apache2下面这个第三方程序是什么呢?   flup可以吗?

在 2009年6月22日星期一UTC+8上午9时18分59秒,qyb写道:
Reply all
Reply to author
Forward
0 new messages