#deploy django with channels to server

8 messages · Page 1 of 1 (latest)

spring jolt
#

I’m kind of new to django and am searching for the right way to deploy a little django app which contains channels and redis/asgi-configuration ..
I don’t understand if I need docker, nginx, daphne or any other thing.

brazen aspen
#

I personally try to run all my Django projects in Docker, but it's not strictly necessary.
You likely will need a server like nginx to serve static and possibly media files, you definitely want to use nginx to upgrade the websocket connection and pass it off to channels, and you do need an ASGI server to run the app itself, for which Daphne should be a pretty good choice.

spring jolt
#

Thanks.
Am I right with that:
Let’s say I want to deploy to a cloud server like AWS, DigitalOcean or sth. I would have to dockerise my PWA and install a venv, nginx, daphne and the docker-image on the cloud server and then connect my domain to that server where the docker image is?

brazen aspen
#

I usually dockerize, install gitlab-runner, add gitlab-ci code, and have it build my image straight on my VPS upon push.

#

If you do use docker, then you can install daphne in the python/django container, run an nginx image in docker, and skip the virtual env... Your dependencies are already isolated in the container.

#

I also use Traefik as an edge router... it helps make things like exposing services and Let's Encrypt certificates easier.

#

Finally, if you do go the Docker route... do use Docker Compose as well... it makes a ton of stuff easier.

scenic vector