Wednesday, October 10, 2012

How to fix django runserver 'port already in use' error

This usually happens if you  $ python manage.py runserver 8000 and then don't stop the server by hitting Cntrl+C but hit something like Cntrl+Z instead.

To stop the server on port 8000 so that you can run another instance again you can do the following..

Run the below command to list all your processes with 'manage' in their name.
$ ps aux | grep -i manage

Note the process_id (pid)  for our "manage.py runserver" process which should be the second column from the left.

And then simply run
$ kill -9 <pid>

e.g. $ kill -9 30144

Ref: http://stackoverflow.com/a/5788609/1415352

7 comments:

  1. Thanks, I managed to stop my Django server.

    ReplyDelete
  2. A little over four years later an this still is helping people. Thank you!

    ReplyDelete
  3. how to fix python manage.py runserver error
    not run

    ReplyDelete
  4. I like your blog, I read this blog please update more content on python, further check it once at python online training

    ReplyDelete

Popular Posts