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!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!