2011-02-14 194 views
0

我试图运行从官方网站上的Hello World演示:问题运行webpy的Hello World演示

import web 

urls = ('/.*', 'index') 
app = web.application(urls, globals()) 

class index: 
    def GET(self): 
     return 'Hello,world......' 

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

当我运行它,我得到的错误:

File "E:\Text-1.py", line 15, in <module> 
    app.run() 
    File "D:\tool\EPD\lib\site-packages\web\application.py", line 316, in run 
    return wsgi.runwsgi(self.wsgifunc(*middleware)) 
    File "E:\Text-1.py", line 14, in <lambda> 
    web.wsgi.runwsgi = lambda func, addr = None: web.wsgi.runfcgi(func, addr) 
    File "D:\tool\EPD\lib\site-packages\web\wsgi.py", line 17, in runfcgi 
    return flups.WSGIServer(func, multiplexed=True, bindAddress=addr).run() 
    File "D:\tool\EPD\lib\site-packages\flup-1.0.3.dev_20110111-py2.6.egg\flup\server\fcgi.py", line 112, in run 
    sock = self._setupSocket() 
    File "D:\tool\EPD\lib\site-packages\flup-1.0.3.dev_20110111-py2.6.egg\flup\server\fcgi_base.py", line 1020, in _setupSocket 
    'If you want FCGI, please create an external FCGI server ' 
ValueError: If you want FCGI, please create an external FCGI server by providing a valid bindAddress. If you want CGI, please force CGI operation. Use FCGI_FORCE_CGI=Y environment or forceCGI parameter. 

什么问题?

+0

我已将格式化问题更易于阅读。它看起来不像你改变了代码或错误,所以我将它恢复了原状。如果您确实进行了更改,请保留格式,以便我们阅读起来更加轻松。 – 2011-02-14 03:05:38

+1

不要说我没试过... – 2011-02-14 03:10:41

回答

1

我不知道是否有帮助,但我只是注释掉这一行:

web.wsgi.runwsgi = lambda func, addr = None: web.wsgi.runfcgi(func, addr)

它运行正常。