Public | Automated Build

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

Django-Docker

A django container compose powered by Docker.

Dockerfile

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

django-docker/
├── apps
│   └── django-tutorial
│       ├── manage.py
│       ├── 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 settings.py (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 / {
    uwsgi_pass 127.0.0.1:49162;
    include uwsgi_params;
}

Docker Pull Command
Owner
douglarek
Source Repository

Comments (0)