title: Failed to start Gunicorn
body: <p>Trying to deploy django app on ubuntu.</p>
  <p>start-server.sh has</p>
  <pre><code>cd /home/django
  source env/bin/activate
  cd tutorial
  gunicorn tutorial.wsgi
  </code></pre>
  <p>If I bash start-server.sh everything runs perfectly fine.</p>
  <p>So, I wrote following thing.</p>
  <p>gunicorn.service saved at /etc/systemd/system/ looks like</p>
  <pre><code>[Unit]
  Description=Gunicorn
  After=network.target
  
  [Service]
  Type=simple
  User=django
  ExecStart=/bin/bash /home/django/bin/start-server.sh
  Restart=on-failure
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  <p>then I run</p>
  <pre><code> sudo systemctl enable gunicorn
   sudo systemctl start gunicorn
  </code></pre>
  <p>but now I see 502 error. when I bash start-server.sh, everything was perfect. but, somehow with gunicorn its not working.</p>
  <p>guincorn version 18.0(I tried 20.0 but no luck)</p>
  <p>sudo systemctl status gunicorn shows</p>
  <pre><code>● gunicorn.service - Gunicorn
       Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Wed 2021-06-09 16:56:59 UTC; 2min 5s ago
     Main PID: 26285 (code=exited, status=126)
  
  Jun 09 16:56:58 ip-184-168-120-14.ip.secureserver.net systemd[1]: gunicorn.service: Main process exited, code=exited, status=126/n/a
  Jun 09 16:56:58 ip-184-168-120-14.ip.secureserver.net systemd[1]: gunicorn.service: Failed with result 'exit-code'.
  Jun 09 16:56:59 ip-184-168-120-14.ip.secureserver.net systemd[1]: gunicorn.service: Scheduled restart job, restart counter is at 5.
  Jun 09 16:56:59 ip-184-168-120-14.ip.secureserver.net systemd[1]: Stopped Gunicorn.
  Jun 09 16:56:59 ip-184-168-120-14.ip.secureserver.net systemd[1]: gunicorn.service: Start request repeated too quickly.
  Jun 09 16:56:59 ip-184-168-120-14.ip.secureserver.net systemd[1]: gunicorn.service: Failed with result 'exit-code'.
  Jun 09 16:56:59 ip-184-168-120-14.ip.secureserver.net systemd[1]: Failed to start Gunicorn.
  </code></pre>