A simple bare-bones docker image created while working at Hivelocity. This image contains configuration for basic nginx, uwsgi, and django setup. It is built on Alpine.
-
Clone the repo:
git clone https://github.com/Kazanz/docker-nginx-uwsgi-django.git
. -
Build the image:
docker build -t nginx-uwsgi-django .
. -
Run the container:
docker run -p 80:80 nginx-uwsgi-django
. -
Check out your site
curl $(docker-machine ip)
.
-
Remove the initial django project:
rm -r project
. -
Create your own django project:
django-admin.py startproject myproject
. -
Update
uwsgi/uwsgi.ini
to point at your new project:sed -i '' 's/project/myproject/g' uwsgi/uwsgi.ini
.
-
Place a
reqs.txt
file in the main directory. -
Install the requirements via the
Dockerfile
:sed -i '' 's/pip install django/pip install -r \/app\/reqs.txt/g' Dockerfile
.
Defaults to python3.5
.
You can change this line FROM python:3.5-alpine
to FROM python:2.7-apline
in the Dockerfile
to use python2.7
version.
Check the official python repo for other python versions. Use the apline
images.