title: Gunicorn not starting throwing gunicorn.service: Failed with result 'exit-code'. error
body: <p>I'm trying a deploy simple Django application on Digital Ocean by following this [link][1] I follow every work step by step and successfully run that project via python manage.py runserver where it's not throwing any error but when I try to implement it with gunicorn its throw following error</p>
  <blockquote>
  <p>gunicorn.service: Failed with result 'exit-code'.</p>
  </blockquote>
  <p>Here is my following configuration:</p>
  <p><strong>sudo nano /etc/systemd/system/gunicorn.socket</strong></p>
  <pre><code>[Unit]
  Description=gunicorn socket
  
  [Socket]
  ListenStream=/run/gunicorn.sock
  
  [Install]
  WantedBy=sockets.target
  </code></pre>
  <p><strong>sudo nano /etc/systemd/system/gunicorn.service</strong></p>
  <pre><code>[Unit]
  Description=gunicorn daemon
  Requires=gunicorn.socket
  After=network.target
  
  [Service]
  User=pos
  Group=www-data
  WorkingDirectory=/home/pos/pos
  ExecStart=/home/pos/env/bin/gunicorn \
            --access-logfile - \
            --workers 3 \
            --bind unix:/run/gunicorn.sock \
            pos.wsgi:application
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  <p><strong>sudo systemctl status gunicorn.socket</strong></p>
  <pre><code>● gunicorn.socket - gunicorn socket
     Loaded: loaded (/etc/systemd/system/gunicorn.socket; enabled; vendor preset: enabled)
     Active: active (listening) since Tue 2019-11-26 07:39:39 UTC; 12min ago
     Listen: /run/gunicorn.sock (Stream)
     CGroup: /system.slice/gunicorn.socket
  
  Nov 26 07:39:39 POS systemd[1]: Listening on gunicorn socket.
  </code></pre>
  <p>When I try to start gunicorn it's throwing this error</p>
  <p><strong>sudo systemctl status gunicorn</strong></p>
  <pre><code>● gunicorn.service - gunicorn daemon
     Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2019-11-26 07:39:43 UTC; 13min ago
    Process: 718 ExecStart=/home/pos/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/run/gunicorn.sock pos.wsgi:application (code=exited, status=1/FAILURE)
   Main PID: 718 (code=exited, status=1/FAILURE)
  Nov 26 07:39:43 POS gunicorn[718]:     Arbiter(self).run()
  Nov 26 07:39:43 POS gunicorn[718]:   File &quot;/home/pos/env/lib/python3.7/site-packages/gunicorn/arbiter.py&quot;, line 198, in run
  Nov 26 07:39:43 POS gunicorn[718]:     self.start()
  Nov 26 07:39:43 POS gunicorn[718]:   File &quot;/home/pos/env/lib/python3.7/site-packages/gunicorn/arbiter.py&quot;, line 155, in start
  Nov 26 07:39:43 POS gunicorn[718]:     self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)
  Nov 26 07:39:43 POS gunicorn[718]:   File &quot;/home/pos/env/lib/python3.7/site-packages/gunicorn/sock.py&quot;, line 172, in create_sockets
  Nov 26 07:39:43 POS gunicorn[718]:     sock_name = sock.getsockname()
  Nov 26 07:39:43 POS gunicorn[718]: OSError: getsockaddrlen: bad family
  Nov 26 07:39:43 POS systemd[1]: gunicorn.service: Main process exited, code=exited, status=1/FAILURE
  Nov 26 07:39:43 POS systemd[1]: gunicorn.service: Failed with result 'exit-code'.
  </code></pre>
  <p>Anyone helps me to solve this issue?
  [1]: <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04</a></p>