The dreaded 502 error
I use Pycharm while creating a website using Django/python. The website works as expected on localhost through Pycharm, so I decided to try and move it to a webserver. I followed this tutorial multiple times but still get the 502 error. https://www.youtube.com/watch?v=Y-CT_l1dnVU&t=609s
Ngnix error reads:
2017/03/01 04:53:33 [error] 2232#2232: *48 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: *client IP*, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "*host IP*"
and Gunicorn error reads:
root@ueba:/home/django/django_project# service gunicorn status ● gunicorn.service - Gunicorn daemon for Django Project Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: Active: inactive (dead) (Result: exit-code) since Wed 2017-03-01 04:42:29 UTC Process: 23288 ExecStart=/usr/bin/gunicorn --name=django_project --pythonpath= Main PID: 23288 (code=exited, status=1/FAILURE) Mar 01 04:42:29 ueba systemd: gunicorn.service: Unit entered failed state. Mar 01 04:42:29 ueba systemd: gunicorn.service: Failed with result 'exit-code Mar 01 04:42:29 ueba systemd: gunicorn.service: Service hold-off time over, s Mar 01 04:42:29 ueba systemd: Stopped Gunicorn daemon for Django Project. Mar 01 04:42:29 ueba systemd: gunicorn.service: Start request repeated too qu Mar 01 04:42:29 ueba systemd: Failed to start Gunicorn daemon for Django Proj lines 1-12/12 (END)
if it matters, the file system is:
*home *Django *Django_project *Django_project *wsgi.py *init.py *settings.py *urls.py *ueba *migrations (folder) *static (folder) *templates (folder) *init.py *admin.py *apps.py *tests.py *views.py *models.py
I feel like I've tried multiple suggestions and variations of configs for both the ngnix and gunicorn through docs on OD but still haven't nailed it out.
Let me know if I need to provide more docs, thanks!