0

I'm trying to host my Django website for the first time, but it appears that the port is already in use. I haven't hosted anything before and I get the following result with netstat -ntlp:

enter image description here

I would like to keep the standard port if possible... does anyone know a solution? I'm not sudo user.

SJ19
  • 1,933
  • 6
  • 35
  • 68

4 Answers4

8

You need to kill the process which is running on port 8000.To kill, find out the process identifier number or PID of the process to be killed, then pass the PID number to the kill command. For Mac OS/X you can list the process by:lsof -i:8000

And then kill the PID by: kill -9 PID

Ankita Gupta
  • 573
  • 3
  • 13
  • I'm not root so I can't find the PID of processes, as you can see from the netstat screenshot. – SJ19 Dec 21 '17 at 19:55
5

open your Terminal and try this,

sudo fuser -k 8000/tcp
Antu
  • 2,197
  • 3
  • 25
  • 40
Saroj Rai
  • 1,419
  • 14
  • 13
4

If you can't kill the process because you don't have permissions, just serve django in a different port:

python manage.py runserver 8001
schrodingerscatcuriosity
  • 1,780
  • 1
  • 16
  • 31
-2

Sometimes there may be another server is running under that port in your machine or
Use

python manage.py runserver 8000

Note: You can user any port

biruk1230
  • 3,042
  • 4
  • 16
  • 29
Yasara J
  • 1
  • 1