A flexible django container compose powered by Docker.
885
A django container compose powered by Docker.
$ sudo docker build -t <username>/django-docker .
$ 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).
$ sudo docker exec -it <container_name> tail -f /var/log/uwsgi/<project_name>.log
$ 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;
}
Content type
Image
Digest
sha256:a632e5c08…
Size
272.3 MB
Last updated
about 11 years ago
docker pull douglarek/django-docker