Django Server Error: port is already in use
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Island
--
Chapters
00:00 Question
00:27 Accepted answer (Score 746)
00:54 Answer 2 (Score 75)
01:36 Answer 3 (Score 16)
02:02 Answer 4 (Score 13)
02:29 Thank you
--
Full question
https://stackoverflow.com/questions/2023...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Island
--
Chapters
00:00 Question
00:27 Accepted answer (Score 746)
00:54 Answer 2 (Score 75)
01:36 Answer 3 (Score 16)
02:02 Answer 4 (Score 13)
02:29 Thank you
--
Full question
https://stackoverflow.com/questions/2023...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django
#avk47
ACCEPTED ANSWER
Score 809
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
ANSWER 2
Score 81
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.
ANSWER 3
Score 17
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
ANSWER 4
Score 15
By default, the runserver command starts the development server on the internal IP at port 8000.
If you want to change the server’s port, pass it as a command-line argument. For instance, this command starts the server on port 8080:
python manage.py runserver 8080