Ubuntu12.04系统下,解决"Django Error: That port is already in use."报错问题

Ubuntu12.04系统下,解决"Django Error: That port is already in use."报错问题

看到上述问题,即端口号已经被占用,说明servr已经在运行了(也有可能在后台运行),找到该进程,kill掉即可.


命令行输入:

jiangge@ubuntu:~/mysite$ ps aux | grep -i manage



会看到类似如下信息: 

 

root       765  0.0  0.0   7204  2812 ?        Ss   08:39   0:00 /usr/sbin/modem-manager
root       826  0.0  0.1  31188  5140 ?        Ssl  08:39   0:02 NetworkManager
root      1295  0.0  0.0   2908  1296 ?        S    08:39   0:00 /sbin/dhclient -d -4 -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/sendsigs.omit.d/network-manager.dhclient-wlan0.pid -lf /var/lib/dhcp/dhclient-03c1a72e-9785-4206-80f3-778eec92bd3c-wlan0.lease -cf /var/run/nm-dhclient-wlan0.conf wlan0
nobody    1648  0.0  0.0   5384  1168 ?        S    08:39   0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf-file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec
jiangge   6386  0.0  0.2  17292 11040 pts/3    S+   12:48   0:00 python manage.py runserver
jiangge   6391  0.7  0.3  29960 14500 pts/3    Sl+  12:48   0:04 /usr/bin/python manage.py runserver
jiangge   6531  0.0  0.0   4372   840 pts/4    S+   12:58   0:00 grep --color=auto -i manage


选择python manage.py runserver对应的 pid(进程id),kill掉进程,释放端口号(free up port 8000):

jiangge@ubuntu:~/mysite$ kill -9 6391

 

本文由@易枭寒([email protected])整理,转载请注明作者信息和出处.

 




你可能感兴趣的:(Django)