重新启动Django服务器会出现以下错误:
this port is already running....
这个问题只发生在Ubuntu上,而不是其他操作系统上。如何释放端口以重新启动服务器?
重新启动Django服务器会出现以下错误:
this port is already running....
这个问题只发生在Ubuntu上,而不是其他操作系统上。如何释放端口以重新启动服务器?
当前回答
如果你在MAC中遇到这个问题,你只需要打开活动监视器并强制相当python,然后再试一次
其他回答
ps aux | grep -i manage
after that you will see all process
ubuntu@ip-10-154-22-113:~/django-apps/projectname$ ps aux | grep -i manage
ubuntu 3439 0.0 2.3 40228 14064 pts/0 T 06:47 0:00 python manage.py runserver project name
ubuntu 3440 1.4 9.7 200996 59324 pts/0 Tl 06:47 2:52 /usr/bin/python manage.py runserver project name
ubuntu 4581 0.0 0.1 7988 892 pts/0 S+ 10:02 0:00 grep --color=auto -i manage
kill -9 process id
e.d kill -9 3440
`enter code here`after that :
python manage.py runserver project name
一个更简单的解决方案是键入sudo fuser -k 8000/tcp。 这将杀死与端口8000关联的所有进程。
编辑:
对于osx用户,可以使用sudo lsof -t -i tcp:8000 | xargs kill -9
lsof -t -i tcp:8000 | xargs kill -9
如果您正在使用VSC的屏幕终端,该错误可能是由于您已经在其他shell中运行server的事实。
只需单击VSC终端头部+符号左侧的dropbox,并选择一些其他shell,检查服务器是否已经在那里运行。退出该服务器并准备启动另一个服务器。
我们不使用这个命令{sudo lsof -t -i tcp:8000 | xargs kill -9},因为它关闭了所有选项卡…你应该用to
Ps -ef | grep python Kill -9 process_id
显示所有带id的grep进程
杀死-9 11633 (11633是进程id到:- /bin/python manage.py runserver)