Bottle python程序在开发环境中运行,但不在实时环境中运行

时间:2017-04-10 06:21:55

标签: python centos bottle

我试图让python bottle application运行,但由于某种原因它失败了。我在cent os 7.2版本上使用了瓶子0.13和python 2.7。

相同的程序在开发环境中运行,其中包含centos 6.7但不在实时环境中。我得到以下堆栈跟踪:

File "helloworld.py", line 7, in <module>run(host='localhost', port=8080)
File "/bottle.py", line 3127, in run server.run(app) File "/bottle.py", line 2781, in run
srv = make_server(self.host, self.port, app, server_cls, handler_cls)
File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 144, in make_server
server = server_class((host, port), handler_class)
File "/usr/lib64/python2.7/SocketServer.py", line 420, in _init_self.server_activate()
File "/usr/lib64/python2.7/SocketServer.py", line 439, in server_activate
self.socket.listen(self.request_queue_size)
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)socket.error: [Errno 98] Address already in use

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

看起来已经有一个进程侦听端口8080。您可以使用以下命令检查谁正在使用8080

lsof -i :8080

要更改端口,请将port=8080参数编辑到其他端口并重新运行应用程序:

run(host='localhost', port=8080)