Open-Source Wikis

/

Django

/

Fun facts

django/django

Fun facts

A handful of curiosities pulled out of the source tree and the git history.

The name comes from a guitarist

Django is named after Django Reinhardt, the Belgian-Romani jazz guitarist. The original Lawrence Journal-World team picked the name because they wanted something short, pronounceable, and unrelated to web technology. There is no acronym to expand. The unicode-aware slugify in django/utils/text.py will, predictably, slugify "Django" to django.

The first commit is older than the framework

The first three commits in the public repo, all dated 2005-07-13, describe the move from a private SVN repository:

Created basic repository structure
Imported fledgeling Django documentation from private SVN repository
Imported Django from private SVN repository (created from r. 8825)

That r. 8825 reference means Django already had nearly nine thousand SVN revisions before its public history began. The Lawrence Journal-World started writing what would become Django in 2003.

The largest single file is a query builder

django/db/models/query.py is 3,024 lines — the longest source file in the framework. It's the home of QuerySet, RawQuerySet, the prefetch machinery, and the async query API. It has been continuously rewritten since 1.0; if you look at its git log you'll find commits from over a hundred different authors.

The runner-up is django/db/models/fields/__init__.py at 2,972 lines, which contains every built-in field class in alphabetical proximity to the field machinery itself. Splitting it up is a perennial discussion that has never been resolved because every split ends up requiring deep import-cycle work.

The framework has only three runtime dependencies

pyproject.toml declares:

dependencies = [
    "asgiref>=3.9.1",
    "sqlparse>=0.5.0",
    "tzdata; sys_platform == 'win32'",
]

Two of these (asgiref and sqlparse) are themselves maintained by Django Software Foundation members. tzdata is only required on Windows, which doesn't ship the IANA timezone database. Compare this to most modern web frameworks, which pull in dozens of transitive dependencies.

The codebase is essentially bot-free

Out of 34,528 commits, only 3 carry a Co-authored-by: ...[bot] trailer. Django predates GitHub bots and the project's workflow runs through Trac (code.djangoproject.com), not the GitHub UI. Dependabot, mergify, and friends are not installed.

TODO/FIXME count is impressively low

A grep across django/*.py for TODO, FIXME, HACK, and XXX finds only 32 occurrences in the entire 165 kLOC codebase. That's roughly one annotation per 5,000 lines. Whether that's because the code is unusually clean or because the project culture frowns on shipping TODOs is left as an exercise for the reader.

The migration autodetector is one file

django/db/migrations/autodetector.py is a 2,066-line file dedicated to figuring out what migration operations to emit when your model state has changed. It does graph reasoning, dependency ordering, swappable model handling, and SQL-side reordering all in one module. It also has the largest test app in the project (tests/migrations/), with hundreds of fixture model definitions.

django.contrib.admin ships a curated set of common passwords

django/contrib/auth/common-passwords.txt.gz is a gzipped list (80 KB compressed) of the most common passwords seen in breach corpora. It's used by CommonPasswordValidator in password_validation.py to reject obviously bad passwords without making an external request. Updating it requires a Trac ticket and a careful review.

The version sentinel is unconventional

django/__init__.py defines:

VERSION = (6, 1, 0, "alpha", 0)

Django uses a five-element version tuple where the fourth element is a release-stage string ("alpha", "beta", "rc", "final") and the fifth is a sub-version. django.utils.version.get_version() formats this to a PEP 440-compatible string. The convention is older than PEP 440 itself.

The OpenLayers version bump is a recurring tradition

git log --oneline | grep -i openlayers shows roughly one commit per year bumping the bundled OpenLayers JavaScript library used by django.contrib.gis.admin's map widgets. The latest is f3ff680c76 Fixed #36990 -- Bumped OpenLayers to 10.9.0. This is one of the few times Django ships third-party JavaScript inside the wheel.

django.shortcuts.render predates type hints

django/shortcuts.py — the home of render, redirect, get_object_or_404, and friends — is one of the oldest files in the framework. It still has no type hints. Every attempt to add them has run into the question of how to express "this can be a model class or a queryset or a manager" cleanly, and the question keeps getting deferred.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Fun facts – Django wiki | Factory