title: Gunicorn + Supervisor configuration issue. Django project deployed on amazon ec2 + ubuntu + nginx
body: <p>I've been running a django project on an ubuntu ec2 instance with gunicorn and nginx. I know it was running for at least a couple days with no issues, but I just checked in on it a week after deployment, and it is no longer running. I get a 502 Bad Gateway error when I access the site. I put in my usual gunicorn command, 
  <code>sudo gunicorn adventure_time.wsgi:application –b 127.0.0.1:8001</code> but all I get is </p>
  
  <pre><code>[2015-07-28 05:14:47 +0000] [11164] [INFO] Starting gunicorn 19.3.0
  [2015-07-28 05:14:47 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
  [2015-07-28 05:14:47 +0000] [11164] [ERROR] Retrying in 1 second.
  [2015-07-28 05:14:48 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
  [2015-07-28 05:14:48 +0000] [11164] [ERROR] Retrying in 1 second.
  [2015-07-28 05:14:49 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
  [2015-07-28 05:14:49 +0000] [11164] [ERROR] Retrying in 1 second.
  [2015-07-28 05:14:50 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
  [2015-07-28 05:14:50 +0000] [11164] [ERROR] Retrying in 1 second.
  [2015-07-28 05:14:51 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
  [2015-07-28 05:14:51 +0000] [11164] [ERROR] Retrying in 1 second.
  [2015-07-28 05:14:52 +0000] [11164] [ERROR] Can't connect to ('127.0.0.1', 8000)
  </code></pre>
  
  <p><code>netstat -tulpn</code> shows me this:</p>
  
  <pre><code>Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
  tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -
  tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      -
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      11126/nginx: worker
  tcp6       0      0 :::22                   :::*                    LISTEN      -
  udp        0      0 0.0.0.0:68              0.0.0.0:*                           -
  udp        0      0 0.0.0.0:30444           0.0.0.0:*                           -
  udp6       0      0 :::63162                :::*                                -
  </code></pre>
  
  <p>So... it seems like nothing is running on 127.0.0.1:8000. Nothing for me to kill. (I've also tried <code>sudo pkill gunicorn</code>)Anyone got some tips on what I can do get my site running again? Also, why is it that gunicorn is still trying to connect to port 8000, but in my command I've asked it to connect to 8001? Thanks!!</p>
  
  <p>edit: I think it's more than just gunicorn. I'm also running supervisor, and I feel like that might be part of the issue.</p>
  
  <p>Inside my project folder is <code>gunicorn.conf.py</code></p>
  
  <pre><code>proc_name = "at_api"
  bind = '127.0.0.1:8001'
  loglevel = "error"
  workers = 2
  </code></pre>
  
  <p>Inside my <code>/etc/supervisor/conf.d/at_api.conf</code></p>
  
  <pre><code>[group:at_api]
  programs=gunicorn_at_api
  
  [program:gunicorn_at_api]
  command=/home/ubuntu/.virtualenvs/adventure_time/bin/gunicorn -c gunicorn.conf.py -p gunicorn.pid wsgi:app\
  lication --pythonpath directory=/home/ubuntu/at_api
  user=ubuntu
  autostart=true
  autorestart=true
  redirect_stderr=true
  </code></pre>