Skip to content
A production oriented dockerized django app
Python Nginx
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
db
demoapp
media
nginx
proj
requirements
static
.dockerignore
.gitignore
Dockerfile
LICENSE
README.md
docker-compose.yml
manage.py
requirements.txt
secrets.env.sample

README.md

Django Docker Compose

A production oriented dockerized django app. explained in more details on my blog

Architecture

This app is using what one could call a standard django app. Including the followings :

  • Django running on gunicorn
  • Celery worker
  • Postgres database
  • RabbitMQ
  • Nginx frontend server

Prerequisites

This required docker, docker-machine and docker-compose installed on your local machine. More informations on Docker's website

Running locally

# creates a local host for docker containers, only do once
docker-machine create -d virtualbox local

# create your config secrets
cp secrets.env.sample secrets.env

# load the docker env
eval "$(docker-machine env local)"

# build web image
docker-compose build

docker-compose up -d

# run commands inside the containers
docker-compose run app python manage.py migrate

How can make sure it works ?

  1. first you need to know your local docker machine ip, using docker-machine ls.
  2. Visit http://LOCAL_IP
  3. Check celery's worker logs docker-compose logs worker

Consideration

docker compose is not deemed production ready. There are some limitations, mainly related to scalability. But I think it is fine for small applications. It is obviously much better to understand how docker compose works. more info on docker's website.

Tutum

The big news is tutum has been acquired by Docker. Tutum is a could service to manage and deploy Docker applications. It uses a stack descriptor, which is compatible with docker-compose yaml format. So you can use my example project to deploy and mange your app with tutum.

You can’t perform that action at this time.