close

[Solved] Django Server Error: port is already in use

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Django Server Error: port is already in use in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Django Server Error: port is already in use Error Occurs?

Today I get the following error Django Server Error: port is already in use in python.

How To Solve Django Server Error: port is already in use Error ?

  1. How To Solve Django Server Error: port is already in use Error ?

    To Solve Django Server Error: port is already in use Error A more simple solution just type sudo fuser -k 8000/tcp. This should kill all the processes associated with port 8000.

  2. Django Server Error: port is already in use

    To Solve Django Server Error: port is already in use Error A more simple solution just type sudo fuser -k 8000/tcp. This should kill all the processes associated with port 8000.

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.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read