How to do it...

Let's explore the Django and Docker boilerplate:

  1. Download the code from https://github.com/archatas/django_docker to your computer to the ~/projects/django_docker directory, for example.
If you choose another directory, for example, myproject_docker, then you will have to do a global search and replace django_docker with myproject_docker.
  1. Open the docker-compose.yml file. There are three containers that need to be created: nginx, gunicorn, and db. Don't worry if it looks complicated; we'll describe it in detail later:
# docker-compose.ymlversion: "3.7"services:  nginx:    image: nginx:latest    ports:      - "80:80"    volumes:      - ./config/nginx/conf.d:/etc/nginx/conf.d      - static_volume:/home/myproject/static - media_volume:/home/myproject/media ...

Get Django 3 Web Development Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.