Public | Automated Build

Last pushed: 3 years ago
Short Description
A flexible django container compose powered by Docker.
Full Description


A django container compose powered by Docker.


Use this to build a new image

$ sudo docker build -t <username>/django-docker .

Running the container

$ sudo docker run -d -p 8000  --name <container_name> -e "PROJECT_NAME=<project_name>" -e "SITE_NAME=<site_name>" -v $PWD/apps:/opt/apps <user_name>/django-docker

# for example

├── apps
│   └── django-tutorial
│       ├──
│       ├── mysite
│       ├── polls
│       ├── requirements.txt
│       └── templates
└── Dockerfile

project_name is your django project name (django_tutorial in the example);

site_name is your django site directory which contains (mysite in the example);

$PWD can be any of a directory contains a apps directory and your django app in apps (django-docker in the example).

Access your running container's uwsgi log

$ sudo docker exec -it <container_name> tail -f /var/log/uwsgi/<project_name>.log

Get your container's mapping port in your host

$ sudo docker inspect <container_name> | grep HostPort | cut -d '"' -f 4
  49162 # this may be not same

Now go to <host_ip>:49162 in your browser or put it into your nginx config file:

location / {
    include uwsgi_params;

Docker Pull Command
Source Repository