铁雪资源网 Design By www.gsvan.com

问题描述

因为项目强制关闭,但是服务还在运行,导致重新运行项目时候 提示地址已经使用(端口被占用)

/usr/bin/python3.5 python-login-demo/index.py
http://0.0.0.0:8080/
Traceback (most recent call last):
 File "/var/www/git/mine/python-login-demo/index.py", line 64, in <module>
 application.run()
 File "/usr/local/lib/python3.5/dist-packages/web/application.py", line 341, in run
 return wsgi.runwsgi(self.wsgifunc(*middleware))
 File "/usr/local/lib/python3.5/dist-packages/web/wsgi.py", line 59, in runwsgi
 return httpserver.runsimple(func, server_addr)
 File "/usr/local/lib/python3.5/dist-packages/web/httpserver.py", line 177, in runsimple
 server.start()
 File "/usr/local/lib/python3.5/dist-packages/web/wsgiserver/wsgiserver3.py", line 1669, in start
 raise socket.error(msg)
OSError: No socket could be created -- (('0.0.0.0', 8080): [Errno 98] Address already in use)

解决方法

查找(<strong>lsof</strong>)该进程, 并结束(<strong>kill</strong>)该进程 即可.

$ lsof -i:8080               130 ↵
COMMAND  PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3.5 31982 willike 3u IPv4 593966  0t0 TCP *:http-alt (LISTEN)

$ sudo kill 31982

以上这篇解决python web项目意外关闭,但占用端口的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

标签:
python,web项目,关闭,占用端口

铁雪资源网 Design By www.gsvan.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
铁雪资源网 Design By www.gsvan.com

评论“解决python web项目意外关闭,但占用端口的问题”

暂无解决python web项目意外关闭,但占用端口的问题的评论...