Docker Django

tl;dr

$ git clone [email protected]:erroneousboat/docker-django.git
$ docker-compose up

Now you can access the application at https://localhost and the admin site at https://localhost/admin.

A project to get you started with Docker and Django. This is made to serve as an example for you to hack on, so I don’t claim that this is the correct way to setup a system with Django and Docker. Thus, I advice to also look at other projects.

Stack and version numbers used:

Name Version
Django 2.1.4
Nginx 1.15
Postgresql 11.1
uWSGI 2.0.17.1

Folder structure

$ tree -L 1 --dirsfirst
.
├── config              # files needed for configuration
├── webapp              # actual webapp
├── docker-compose.yml  # docker-compose setup with container orchestration instructions
├── LICENSE             # license for this project
└── README.md           # this file

Setting up

Docker

See installation instructions at: docker documentation

Docker Compose

Install docker compose, see installation instructions at https://docs.docker.com/compose/install/

Django

Create django project in the webapp folder or copy a project to the webapp folder or use the sample project enclosed in this project and go directly to the section ‘Fire it up’:

<div class="highlight highlight-source-shell position-relative" data-snippet-clipboard-copy-content="# Be sure you have Django installed on your system
$ django-admin startproject
“>

# Be sure you have Django installed on your system
$ django-admin startproject <name_project>