# Django vs Ruby on Rails: source lines of code compared

The Django vs Ruby on Rails comparison on OctoCounts shows side-by-side source line counts for django/django and rails/rails, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-09-08, django/django contains 543,623 total lines (392,744 code) across 3,582 files, while rails/rails contains 305,333 total lines (138,140 code) across 1,866 files as of 2026-09-17. django/django is about 2.8x the size of rails/rails by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [django/django](https://octocounts.com/github/django/django) | [rails/rails](https://octocounts.com/github/rails/rails) |
| --- | ---: | ---: |
| Files | 3,582 | 1,866 |
| Total lines | 543,623 | 305,333 |
| Code lines | 392,744 | 138,140 |
| Comment lines | 44,971 | 115,654 |
| Blank lines | 105,908 | 51,539 |
| Languages counted | 12 | 12 |

Top languages in django/django: PO File (60.8% of code), Python (31.1% of code), Modelica (5.6% of code). Top languages in rails/rails: Ruby (86.9% of code), JavaScript (8.5% of code), Rakefile (1.3% of code). JavaScript appears in both top language lists; PO File, Python, Modelica, CSS appear only in django/django's top languages; Ruby, Rakefile, Sass, Ruby HTML appear only in rails/rails's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. django/django was counted at ref 802baf5da5b8d8b44990a8214a43b951e7ab8b39 (commit 802baf5da5b8) on 2026-09-08; rails/rails was counted at ref 6b52f384babca028b0e4e63651c2e634f123a2cd (commit 6b52f384babc) on 2026-09-17. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

django/django counts the Django framework repository — the Python web framework, its bundled contrib apps, documentation source, and test suite. rails/rails counts the Ruby on Rails repository — the Rails framework's core components (Active Record, Action Pack, and the other constituent modules) with their tests. Both counts are full web-framework source trees, counted on the dates shown above.

The language tables make the comparison structurally simple: Django's counted tree is Python, and Rails' counted tree is Ruby, so the totals measure two framework codebases in their respective implementation languages.

Both repositories include their documentation source and extensive test suites alongside the framework code, so a meaningful share of each count exists for correctness and explanation rather than for the runtime alone.

_Framework repository size does not predict application performance or development speed for your project: a production app adds its own code, third-party gems/packages, and configuration on top of a small subset of the framework._

Sources: [django/django repository](https://github.com/django/django) · [rails/rails repository](https://github.com/rails/rails). Statements verified 2026-09-16.

Evidence and next steps:

- [django/django SLOC report](https://octocounts.com/github/django/django)
- [rails/rails SLOC report](https://octocounts.com/github/rails/rails)
- [Compare django/django and rails/rails interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fdjango%2Fdjango&right=https%3A%2F%2Fgithub.com%2Frails%2Frails)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, django/django or rails/rails?

django/django has more code: 392,744 code lines versus 138,140 for rails/rails, about 2.8x as much, based on cached OctoCounts reports as of 2026-09-17.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for django/django, rails/rails, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. django/django was counted at ref 802baf5da5b8d8b44990a8214a43b951e7ab8b39 (commit 802baf5da5b8) on 2026-09-08; rails/rails was counted at ref 6b52f384babca028b0e4e63651c2e634f123a2cd (commit 6b52f384babc) on 2026-09-17. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
