I would like to deploy this project which works perfectly on localhost or on python manage.py runserver command, when I try to deploy it I read on the documentation on the worker you should add these to gunicorn service which when I do -k eventlet -w 1, it returns 502 bad gateway This is what i'm getting based off https://github.com/miguelgrinberg/python-socketio/tree/main/examples/server/wsgi/django_example This is my gunicorn service
[Unit]
Description=gunicorn daemon
Requires=dev.socket
After=network.target
[Unit]
Description=gunicorn daemon
Requires=dev.socket
After=network.target
[Service]
User=myuser
Group=www-data
WorkingDirectory=/var/lib/jenkins/workspace/myproject
ExecStart=/var/lib/jenkins/workspace/myproject/env/bin/gunicorn \
--access-logfile - \
--workers 3 \
-k eventlet \
--bind unix:/run/dev.sock \
myproject.wsgi:application
[Install]
WantedBy=multi-user.target
wsgi.py
import os
from django.core.wsgi import get_wsgi_application
import socketio
from app.views import sio
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
wsgi_application = get_wsgi_application()
application = socketio.WSGIApp(sio, wsgi_application)
settings.py
...
WSGI_APPLICATION = 'myproject.wsgi.application'
...
If I remove the -k eventlet from the dev.service gunicorn service, the 502 bad gateway goes away and the page keeps loading forever and it returns 504 Gateway Time-out, and if I revert back wsgi.py to it's django by default boilerplate, it shows the page, but the websockets doesn't work and the page keeps sending https://example.com/socket.io/?EIO=4&transport=polling&t=opIU5ZA GET requests, that gets 502 bad gateway
I would like to deploy this project which works perfectly on localhost or on python manage.py runserver command, when I try to deploy it I read on the documentation on the worker you should add these to gunicorn service which when I do -k eventlet -w 1, it returns 502 bad gateway This is what i'm getting based off https://github.com/miguelgrinberg/python-socketio/tree/main/examples/server/wsgi/django_example This is my gunicorn service
wsgi.py
settings.py
If I remove the -k eventlet from the dev.service gunicorn service, the 502 bad gateway goes away and the page keeps loading forever and it returns 504 Gateway Time-out, and if I revert back wsgi.py to it's django by default boilerplate, it shows the page, but the websockets doesn't work and the page keeps sending https://example.com/socket.io/?EIO=4&transport=polling&t=opIU5ZA GET requests, that gets 502 bad gateway