Skip to content

Dockerfile and configuration files to build a working Django container with uwsgi and nginx

Notifications You must be signed in to change notification settings

wilane/django-uwsgi-nginx

 
 

Repository files navigation

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 https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Feel free to clone this and modify it to your liking. And feel free to contribute patches.

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 Bootstrap 3.0.2 (located in the base app, with css and javascript loaded from 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

About

Dockerfile and configuration files to build a working Django container with uwsgi and nginx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published