Django, uWSGI and Nginx in a container
This Dockerfile allows you to build a Docker container with a fairly standard
and speedy setup for Django with uWSGI.
uWSGI from a number of benchmarks has shown to be the fastest server
for python applications and allows lots of flexibility.
Most of this setup comes from the excellent tutorial on
Feel free to clone this and modify it to your liking. And feel free to
Build and run
- docker build -t webapp .
- docker run -d webapp
How to insert your application
In /usr/src/app/src currently a django project is created with startproject
using the template from https://github.com/xenith/django-base-template that
features "set of basic templates built from HTML5Boilerplate 4.1.0 and Twitter
CloudFlare CDN by default)." You will probably want to replace the content of
/app/src with the root of your django project if you already have one.
uWSGI chdirs to /usr/src/app/src so in uwsgi.ini you will need to make sure the
python path to the wsgi.py file is relative to that. Also note that the
template contains a conf directory with nginx, supervisor and uwsgi configs