运行webpy Hello World演示时出现问题

时间:2011-02-14 02:57:17

标签: python web.py

我正在尝试从官方网站运行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.

有什么问题?

1 个答案:

答案 0 :(得分:1)

我不知道这是否有帮助,但我只是评论了这一行:

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

运行正常。