Working with Docker containers for Django, Gunicorn, Nginx, and PostgreSQL

Django projects depend not only on Python requirements, but also on many system requirements, such as a web server, database, server cache, and mail server. When developing a Django project, you need to ensure that all environments and all developers will have all the same requirements installed. One way to keep those dependencies in sync is to use Docker. With Docker, you can have different versions of the database, web, or other servers required individually for each project.

Docker is a system for creating configured, customized virtual machines called containers. It allows us to duplicate the setup of any production environment precisely. Docker containers are created from so-called Docker images. Images consist of layers (or instructions) on how to build the container. There can be an image for PostgreSQL, an image for Redis, an image for Memcached, and a custom image for your Django project, and all those images can be combined into accompanying containers with Docker Compose.

In this recipe, we will use a project boilerplate to set up a Django project with a PostgreSQL database, served by Nginx and Gunicorn, and manage all of them with Docker Compose.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.107.241