我在Windows上写了一个瓶子应用程序并将其移动到也运行apache web服务器的centos服务器。我有瓶子跑:
Bottle v0.12.9 server starting up (using GeventServer())...
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.
每当我尝试使用curl http://127.0.0.1:8080/bottle/main.py向服务器发送请求时,它都会响应:
HTTP/1.1 404 Not Found
Date: Tue, 12 Jul 2016 18:59:29 GMT
Content-Length: 233
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL http://127.0.0.1:8080/bottle/main.py was not found on this server.</p>
</body></html>
服务器上没有显示任何活动。我认为某种方式apache正在篡改请求或其他东西,但我不知道。有什么想法吗?
答案 0 :(得分:0)
这不是瓶子的工作原理,如果您的代码如下所示:
import bottle
@bottle.route("/hello")
def func():
return "hello!!!!!!!"
if __name__ == "__main__":
bottle.run(port=8080)
然后浏览到http://127.0.0.1:8080/hello
您好!!!!!!!