You cannot use gunicorn to run WebSockets or other async code - you need an ASGI server, like Daphne or uvicorn. Switch to one of those and it should start working.
Andrew On Fri, Nov 16, 2018 at 8:11 PM Robert Fox <pv2...@gmail.com> wrote: > I am working on a project using Django and Channels 2.1.1. Everything is > working splendidly on my home PC but when I deploy to AWS I get the error: > 'WebSocket connection to 'ws://IP/ws/lobby/' failed: Error during WebSocket > handshake: Unexpected response code: 404 ' which originates from the line > in my HTML where I establish the chat socket : > var chatSocket = new WebSocket( > 'ws://' + window.location.host + '/ws/' + roomName + '/' > ); > I am using nginx and gunicorn to run my Django application on the host > machine. > When I went to the Channels 2 tutorial it has a section for testing > communication between the channels layer and Redis using the > Django Shell which I tested and works. > My full code can be seen at https://github.com/Rob-Fox/Chat2 > > Thank you > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/16ed620b-c05f-4392-8d84-6cbd85436ca2%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/16ed620b-c05f-4392-8d84-6cbd85436ca2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1uq_EsgV2jt-PzMFsL1%2BAnQqEX0r4XHjLKPa5D_XZcfi4w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.