DRY model-view-controller framework for Python web applications.
web | code | documentation | awesome | BSD

See also | :python
See also (alternative) | :ruby (Rails)


Tutorials (complete project)

Ubuntu setup

Nginx + Postgres + Ubuntu setup


  1. Install :nginx
  2. Install :postgresql (could be on a separate machine)
    1. With a user for django (with CREATE DATABASE privileges)
    2. With psycopg2 dependencies
  3. Install :python
    1. With python-dev (for :uwsgi)


  1. Create empty database (with/for django user)
  2. Create and activate virtualenv
  3. pip install Django
  4. pip install uwsgi
  5. pip install psycopg2
  6. Go to parent of code folders
  7. django-admin startproject <site name>


  1. Connect to database in
    1. See
    2. See
  2. Start Django as a Unix socket via uwsgi
  3. Connect Nginx to the socket
    1. Probably need to chown-socket = www-data:www-data

Other references

Hosting at a subpath (via Nginx)

Modify the Nginx location block as follows:

location /subpath { # rather than / (aka root)
	wsgi_param SCRIPT_NAME /subpath; # explicitly set SCRIPT_NAME to match subpath
	uwsgi_modifier1 30; # strips SCRIPT_NAME from PATH_INFO (the url passed to Django)


Administration interface

Customization (custom actions from admin interface)

Summary row

CSV/spreadsheet export

Timezone-awareness in the Python interpreter

From Python intepreter in Django-based virtualenv:

from django.conf import settings
from django.utils import timezone
settings.configure(USE_TZ=True, TIME_ZONE="UTC")  # returns timezone-aware value


Model updates



ERD diagrams

Kinda related to :graph-drawing

Backlinks: stack python slack ruby graph-drawing django:authentication

CC0 / Public domain dedication To the extent possible under law, d3vid seaward has waived all copyright and related or neighboring rights to "Django in Grasmere notebook, including code snippets" (why? how?)