重新启动Django服务器会出现以下错误:

this port is already running....

这个问题只发生在Ubuntu上,而不是其他操作系统上。如何释放端口以重新启动服务器?


当前回答

点击截图中的箭头,找到已经运行Django服务器的bash。您收到此消息是因为您的服务器已经在运行,您试图再次启动服务器。

其他回答

我们不使用这个命令{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)

很抱歉在旧帖子里发表评论,但它可能会帮助到人们

在你的终端机上打这个

killall -9 python3

它会杀死你机器上运行的所有python3,并释放你的所有端口。极大地帮助我在Django项目中工作。

我尝试了所有的解决方案,但它们都不起作用,我建议你继续按下电源按钮,或者如果你的电池是可拆卸的,然后将其移除,所有进程将被杀死,你的本地主机将被重置

点击截图中的箭头,找到已经运行Django服务器的bash。您收到此消息是因为您的服务器已经在运行,您试图再次启动服务器。

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