Docker container skeleton for building a Python 3 django container. Make sure that docker and docker-compose are installed.
- ngnix proxy (linked to python container)
- Python:3.4 environment running gunicorn (linked to the postgres container)
- Postgres database
- proxy
- web
- db
- Django>=1.7
- django-environ>=0.3.0
- django-braces>=1.4.0
- django-crispy-forms>=1.4.0
- django-admin-bootstrapped>=1.6.9
- django-debug-toolbar>=1.2.1
- django-authtools>=1.0.0
- easy-thumbnails>=2.2
- psycopg2
- gunicorn
docker-compose build
docker-compose up
Other useful commnads:
docker-compose run web django-admin.py startproject mysite .
docker-compose run web python mysite/manage.py syncdb
docker-compose run web python mysite/manage.py makemigrations
docker-compose run web python mysite/manage.py migrate
docker-compose run web /bin/bash
docker ps
docker-compose ps
docker-compose stop
The Dockerfile can be modified to change the working directory after the project is made so that the working directory is in the actual mysite folder and the docker-compose commands will execute directly from that directory.
Your project files can also be added directly to the current working folder on your computer and the site does not have to be from scratch
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
}
}