擅长:python、mysql、java
<p>我想另外两个答案是想说明0.0.0.0不是你应该访问的URL。当Python web服务器(例如cherrypy)说它在0.0.0.0上提供服务时,这意味着它正在监听在该计算机上结束的所有TCP通信,而不管请求的主机名或IP是什么。但是,如果您将其更改为套接字侦听127.0.0.1或“localhost”,则除非请求专门针对该IP/主机名,否则它不会响应该请求。例如,很多时候你可以使用你的机器名而不是本地主机(比如ubuntu允许这个)。如果您的计算机名是'brian',并且您有一个服务器在0.0.0.0:8080上侦听,那么您应该能够使用<a href="http://brian:8080" rel="noreferrer">http://brian:8080</a>访问该服务器。但是,如果服务器正在监听“localhost”,即使“brian”设置为指向“localhost”,服务器也不会收到消息。</p>
<p>您还需要确保文件确实在运行命令的目录中。否则,404响应实际上是正确的:)</p>
<p>祝你好运!</p>