Django Server Error: port is already in use

前端 未结 16 527
借酒劲吻你
借酒劲吻你 2020-12-04 04:34

Restarting the Django server displays the following error:

this port is already running....

This problem occurs specifically on Ubuntu and

相关标签:
16条回答
  • 2020-12-04 05:16

    Sorry for comment in an old post but It may help people

    Just type this on your terminal

    killall -9 python3
    

    It will kill all python3 running on your machine and it will free your all port. Greatly help me when to work in Django project.

    0 讨论(0)
  • 2020-12-04 05:17
    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.

    0 讨论(0)
  • 2020-12-04 05:20

    ps aux | grep manage

    ubuntu 3438 127.0.0 2.3 40256 14064 pts/0 T 06:47 0:00 python manage.py runserver

    kill -9 3438

    0 讨论(0)
  • 2020-12-04 05:20

    Type 'fg' as command after that ctl-c.
    Command:
    Fg will show which is running on background. After that ctl-c will stop it.

    fg
    ctl-c

    0 讨论(0)
提交回复
热议问题