Django Server Error: port is already in use
Solution 1:
A more simple solution just type sudo fuser -k 8000/tcp
.
This should kill all the processes associated with port 8000.
EDIT:
For osx users you can use sudo lsof -t -i tcp:8000 | xargs kill -9
Solution 2:
netstat -ntlp
It will show something like this.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 6599/python
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN -
tcp 0 0 192.168.124.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp6 0 0 :::3306 :::* LISTEN
So now just close the port in which Django/python running already by killing the process associated with it.
kill -9 PID
in my case
kill -9 6599
Now run your Django app.