IdeoREX IdeoREX - 4 months ago 14
Python Question

Close Socket in Django - Error: [Errno 48] Address already in use

I accidentally created an infinite loop on an api call. It got out of hand and I had to shut it down [control + C].

now when I do

$ python manage.py runserver


I get

Validating models...

0 errors found
August 08, 2013 - 12:43:41
Django version 1.5.1, using settings 'summertime.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Error: [Errno 48] Address already in use


Does anyone know how to reset the socket? Can I just shut down my computer

Answer

You have two options the first one is choice another port:

python manage.py runserver 8080

and the other one is killing the process in the port, to find the process:

sudo netstat -tulpn | grep :8000

to kill the process:

kill -9 <pid-of-process>