Open-Source Wikis

/

Django

/

By the numbers

django/django

By the numbers

Data collected on 2026-04-30 from commit 8726605e2d on the main branch.

Size

Django is large but homogeneous: almost all of it is Python. Templates and static assets in django/contrib/admin/ and the GIS contrib app account for most of the non-Python lines. The repository also ships its full test suite, which is roughly twice the size of the framework itself.

xychart-beta horizontal
    title "Python lines of code"
    x-axis ["django/", "tests/", "docs/"]
    y-axis "lines" 0 --> 360000
    bar [165988, 347961, 0]
Area Files Lines
django/ (framework source) 902 .py ~166,000
tests/ 1,986 .py ~348,000
docs/ 726 files reST prose
Total commits in history 34,528

The test suite is more than 2x the size of the framework itself — a deliberate property of Django's "fix the test first" culture. Every Trac-numbered fix lands with a regression test, and changes to public API are gated on test coverage.

Largest source files

These are the heavyweights inside django/. They are the modules where the framework's complexity concentrates: query construction, schema editing, the admin's ModelAdmin, and the model base class.

Lines File Why it's big
3,024 django/db/models/query.py QuerySet, RawQuerySet, prefetch_related, async dispatch
2,972 django/db/models/fields/__init__.py All field classes (CharField, IntegerField, …) and field machinery
2,892 django/db/models/sql/query.py The internal Query object: joins, filters, annotations
2,639 django/contrib/admin/options.py ModelAdmin, the heart of the admin
2,566 django/db/models/base.py Model, __init_subclass__ plumbing, save/delete logic
2,266 django/db/models/sql/compiler.py SQL generation from Query objects
2,235 django/db/models/expressions.py F, Func, Window, Value, Case/When
2,159 django/db/models/fields/related.py ForeignKey, OneToOneField, ManyToManyField
2,086 django/db/backends/base/schema.py BaseDatabaseSchemaEditor (DDL emission)
2,066 django/db/migrations/autodetector.py The migration generator

If you're new to the codebase, do not start with these files. Pages under systems/ point to smaller, more focused entry points.

Activity

The codebase has been releasing on roughly the same cadence — a feature release every eight months, an LTS every two years — for a decade. Recent commit volume is steady at ~75 commits per month.

Year Commits
2005 1,277
2010 1,926
2014 2,792
2018 1,154
2022 961
2024 936
2025 945
2026 320 (through April)

Commit count has stabilised since 2018: the framework is mature and most changes are bug fixes, deprecation cycles, or new ORM/admin capabilities rather than reorganisations.

Active contributors (last year)

Top contributors by commit count over the trailing 12 months:

Commits Contributor
169 Jacob Walls
85 Natalia
67 Mariusz Felisiak
43 Tim Graham
42 Clifford Gama
38 Adam Johnson
35 Mike Edmunds
31 Simon Charette
31 David Smith
25 Sarah Boyce

Roughly 90 unique contributors landed code in the last 90 days. The full AUTHORS file lists 1,153 lines of names — Django's contributor base spans two decades.

Bot-attributed commits

Trace of Co-authored-by: ...[bot] trailers in commit messages: 3 commits out of 34,528 (~0.009%). Django does very little automated work in-tree; the workflow is human-driven (Trac → patch → review → merge).

This is a lower bound on AI-assisted work: inline tools like Copilot leave no trace in git history. What it does say is that bots are not committing en masse — Dependabot is not enabled at the repo level and the maintainer team manually curates the dependency set declared in pyproject.toml.

Complexity hotspots

Beyond the largest files (table above), a few directories are dense in branching logic:

  • django/db/models/sql/ — the compiler, query, and where modules together account for ~7,500 lines of pure SQL construction. They are the highest-cyclomatic-complexity area in the framework.
  • django/db/migrations/autodetector.py — a single 2,066-line file dedicated to deducing migration operations from model state diffs. Changing it usually requires running the entire migrations test app.
  • django/contrib/admin/options.pyModelAdmin exposes a very large surface area; touching it requires running both tests/admin_views/ and tests/modeladmin/.

Test-to-code ratio

Metric Value
Source lines (django/) ~166k
Test lines (tests/) ~348k
Ratio ~2.1 : 1

Most subsystems have a dedicated test app under tests/ (e.g., tests/queries/, tests/migrations/, tests/admin_views/, tests/forms_tests/, tests/template_tests/). When in doubt, the test app is usually the most readable spec for a feature.

Releases

The latest tags on the repo at the time of writing:

Tag Notes
6.0.4 Latest 6.0 patch release
5.2.13 Latest 5.2 patch release
4.2.30 Latest 4.2 LTS release
stable/4.2.x Long-term-support branch

See docs/releases/ for the full chronological release notes.

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

By the numbers – Django wiki | Factory