Base image for django deployments
This image is useful if you want to create production setup for your django application.
Essentially it runs 2 processes:
- gunicorn which actually hosts your django aplication
- Nginx which serves static files and proxies the rest of requests to gunicorn
- You should put you django application code into the following folder of the image:
- Static files should be located under
- You need to point your application to put media into
- It is required to pass env variable
APP_MODULEwhich contains the name of the module to be used as wsgi entry point.
Ensure you updated your django settings accordingly (especially
Here is an example of the Dockerfile which creates an image from the source code (it might be run on CI server
as a part of build process):
FROM logicify/django:1.1 COPY build/code /srv/application COPY build/static /srv/static RUN source /srv/virtenv/bin/activate && \ LANG=en_US.utf8 pip install -r requirements.txt ENV APP_MODULE "our_app.wsgi" ENV APP_PROCESS_NAME "our-app-name"
So basically what it does is copying files from the build folder into valid locations, setting up all dependencies an
required variables. As result you have ready to deploy image.
- PROXY_TIMEOUT - timeout in seconds for nginx proxy (default
- STATIC_URL - url path for static files hosting (default
- STATIC_PATH - location on the file system where nginx should find static files (
- MEDIA_PATH - location on the file system where nginx should find media files (