运行 webpy Hello World 演示时出现问题
我正在尝试从官方网站运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道这是否有帮助,但我只是注释掉了这一行:
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.