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

发布于 2024-10-17 01:12:13 字数 1399 浏览 2 评论 0原文

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

问题是什么?

I'm trying to run the hello world demo from the official web site:

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()  

When I run it, I get the error:

 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.

What's the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮世清欢 2024-10-24 01:12:13

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

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

它运行正常。

I don't know if that helps, but I just commented out this line:

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

It runs ok.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文