Django Channels Along with uWSGI

Viewed 1265

I currently, Django rest api which is developed using docker, nginx, uWSGI, redis, Django & Angular.

I am adding couple of websocket endpoints, I would like to keep the existing architecture and keep serving http requests via uWSGI & nginx. And use Django channels (with nginx) for web-socket connections.

Is that possible? If so, can I use just one container and start uWSGI and daphne on different ports ? Or do I need separate Django app for channels all together and separate container ?

1 Answers

Yes, just make sure paths in your urls.py do not overlap with routing from your CHANNELS_LAYER

CHANNEL_LAYERS = {
    "default": {
        # ...
        "ROUTING": "websockets.routing.channel_routing",
    },
} 
Related