Search code examples
pythonserverwsgigunicorn

Error with gunicorn server start


On an external server, I tried to run the command:

gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application

I got this error:

[2017-01-29 15:08:02 +0000] [19640] [INFO] Starting gunicorn 19.4.5
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:07 +0000] [19640] [ERROR] Can't connect to ('0.0.0.0', 8000)

What can I do to fix this issue?


Solution

  • The error message:

    Connection in use: ('0.0.0.0', 8000)

    Indicates the port is in use. You need to find whoever is currently using the port and turn them off. If you can sudo, you can use netstat to find who is already using the port:

    $ sudo netstat -nlp | grep :80
    tcp  0  0  0.0.0.0:80  0.0.0.0:*  LISTEN  125004/gunicorn
    

    In the example above it is guincorn with a pid of 125004.

    (Source)