【发布时间】:2019-10-23 23:20:56
【问题描述】:
我正在尝试为 web.py 运行 the tutorial code,一切正常,除非我尝试使用浏览器访问 Web 服务器,但它说它无法连接到服务器。 代码如下:
import web
urls = (
'/', 'index'
)
class index:
def GET(self):
return "Hello, world!"
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
我是这样运行的:
$ python code.py
http://0.0.0.0:8080/
据我所知,这正是教程所说的,但就像我说的那样,当我尝试访问 Web 服务器时,它给了我一个错误。例如,当我将地址复制到 Firefox 中时,它给了我这个错误:
Firefox can’t establish a connection to the server at 0.0.0.0:8080.
对我做错了什么有什么想法吗?
【问题讨论】: