- latest, 2.0-python3
About this image
This image can be used as a starting point to run django applications.
It uses gunicorn in the latest version to serve the wsgi application.
The container picks up the wsgi entry point based on the environment variable
Django is already installed within the version specified by the image.
2.0-python3 will contain the latest django version of
The image does also ship with the latest version of
The image does export port
It has a volume defined to generate static resources at
/usr/django/app can be used for live reload during development.
The environment variable
GUNICORN_RELOAD can be set to
true to active live reload if a source file
If the following environment variables are set to
true the corresponding django command will
be executing on container start:
How to use this image
FROM alang/django ENV DJANGO_APP=demo # will start /usr/django/app/demo/wsgi.py COPY src /usr/django/app
Using the onbuild image
-onbuild variant of the image does assume that your build directory (directory where the
Dockerfile is located) contains a directory called
src which is the place where the django source
code is. This directory will be copied to
The image does also assume that your source code contains a
requirements.txt file in the
directory. All dependencies listed there will be installed.
Create new django project
Bootstrap a new project called
demo within the
docker run --rm -v "$PWD/src:/usr/django/app" alang/django django-admin startproject demo app
Executing one off commands
How to execute one off django commands like
docker run --rm -v "$PWD/src:/usr/django/app" alang/django python app/manage.py makemigrations
A custom gunicorn config can be included:
COPY gunicorn.conf /etc/gunicorn/
If you have any problems with or questions about this image, please contact me through a GitHub issue.
You are invited to contribute new features, fixes, or updates, large or small.
Please send me a pull request.