Solution: Django-Error: That port is already in use

created at 06-24-2021 views: 184

For Django newbies, there will be many problems during the learning process, which often encounters the problem is Error: That port is already in Use

There are two ways to solve (assuming 8000 ports): 

1. Open a new port

python runserver 8001

2. Kill off the original port (under root conditions).

2.1 Enter the lsof -i: 8000 in the terminal, list the process information. 

2.2 Then, find the PID number of the process, such as my PID number is 2277.  

2.3 Enter kill -9 PID, such as KILL-9 2277, you can turn off the port. 

2.4 Use python runserver to continue using the 8000 port.

created at:06-24-2021
edited at: 06-24-2021: