For those who already used Docker, you know how everything is smooth and comfortable after the image is appropriately configured and ready to go. But what about the process getting into that state? Either I am doing this wrong, or it requires a LOT of trial and error. It can go without any issues, or it can be very lengthy and time-consuming. That was exactly my experience when creating a Docker image for this Django project.

I will not cover here what Docker is and how it works, but the main essential steps to Dockerize a Django application ready for production.

The project consists of a Django app, using Python 3.8, served by Nginx, and having Celeryas a task manager. It seems pretty straight forward, right? Well, with time, I’ve learned not to trust that.

Image for post

Basic Diagram

As can be seen in the diagram above, we don’t need to include MySql and Redis images, and they are running on different servers. (EC2 instances).

So we only need to properly configure Nginx as a proxy server, uWSGI as HTTP Server, and Celery queues and workers.

#nginx #uwsgi #django #docker #celery

Dockerize a Django Application
4.25 GEEK