django / channels

Developer-friendly asynchrony for Django
https://channels.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.08k stars 800 forks source link

djangochannelsrestframework working with gunicorn #2021

Closed AndreaMascoli closed 10 months ago

AndreaMascoli commented 1 year ago

Is your feature request related to a problem? Please describe. I've a project where i use gunicorn in prod environment. I saw that gunicorn is an application server used only for WSGI mode, so it can't substitute something like Daphne. I've implemented in dev environment the consumers and the websocket connection with them, and all seems to work good using only 'python manage.py runserver' and the configuration found on internet to use daphne and djangochannelsrestframework. I know that daphne was projected to work efficiently with channels library. The problem is that i have to repropose this functionality also in prod env and i have to necessarily use gunicorn. On the web i read that is possible to run gunicorn and Uvicorn as a worker class in order to manage the asgi functionality. The possible solutions that i think i can implement are one of this two: 1 Make djangochannelsrestframework work with uvicorn 2 Run gunicorn and daphne in certain way similar to the uvicorn working class So the questions are : is possible to implement at least one of these solutions ? Which would be the best one?

Describe the solution you'd like I want to run gunicorn server and make work consumers and websocket implemented with daphne

Describe alternatives you've considered 1 Make djangochannelsrestframework work with uvicorn 2 Run gunicorn and daphne in certain way similar to the uvicorn working class

carltongibson commented 10 months ago

You should be able to use uvicorn without issue.