Learning Django or Rails: the honest learning curve

TL;DR

Difficulty: Beginner

  • Learning a framework is three curves: the language, the framework and the ecosystem (tests, deployment, front end).
  • Rails lends you understanding: a working app in week one, then a wall in weeks two to six (autoloading, implicit rendering, generated methods, callbacks, concerns).
  • Django charges up front: a slower first day of explicit wiring, then harder questions about querysets, class based views and the front end.
  • Python is taught far more widely than Ruby, which helps beginners most.
  • Expect a learning tax of about a quarter of the first six months in either framework. Test the wall, not the honeymoon, and judge developers by whether they can trace behaviour to its source.

"A weekend" and "a few years" are both true answers to how long it takes to learn Django or Rails, and neither helps anyone plan. Here is the honest version: the three curves you climb, where each framework gets hard and why, a realistic timeline, and what the learning costs in a real six month budget.

The question, and why the usual answers do not help

Ask how long it takes to learn Django or Ruby on Rails and you will hear two kinds of answer. One says "a weekend": follow the tutorial, and by Sunday evening you have a working blog. The other says "years": you only really know a framework once you have kept a real application alive through several upgrades. Both are true, and neither helps a founder plan a budget or a developer plan a month.

This chapter answers the real question: how long does it take to become productive in each, and what exactly makes each one hard? Productive here means something specific, which I define below. The answer is an estimate, not a measurement, and I say so wherever it matters. What I can give you with confidence is the shape of each learning curve, where its hard places are, why they are there, and how to plan around them.

I build web applications on Ruby on Rails, so read my view with that in mind. I have tried to describe both frameworks so a senior Django developer would nod at every comparison.

If you have not read the first chapter of this series, Django or Rails: two answers to the same question, start there. It explains the two philosophies this chapter keeps coming back to. The second, where Django shines and where Rails shines, maps which products suit which framework.

The example throughout is invented. Freewheel Cycles runs six bicycle repair workshops in and around Limerick (freewheelcycles.example), with 38 mechanics, about 1,150 repair bookings a week and 9,000 active customers. Niamh, the founder, wants to replace a set of spreadsheets and a rented booking widget with the company's own web application. Her two developers are Aisling, who has four years of Python (mostly data analysis, a little Flask), and Cian, who has three years of JavaScript and TypeScript with React. Neither has written Ruby. The budget for the first version is six months.

Rails lends you understanding, Django asks for it up front

Here is the idea the rest of this chapter hangs on. Both frameworks make you pay for understanding. They just bill you at different times.

Rails gives you a working application before you understand it. Its doctrine says so openly: there are conventions "a beginner doesn't even need to know about"1. You get the productivity now, and the understanding is a loan. The loan falls due a few weeks later, usually on the day something behaves unexpectedly and you cannot see where the behaviour comes from. That is the wall Rails developers talk about.

Django asks you to understand more before it gives you much. You create a project, then an app, register the app in the settings, wire a URL to a view by hand and name the template yourself. Its own design philosophy says magic should only happen when it buys a huge convenience and does not confuse people learning the feature2. So the first day is slower, and in return there are fewer surprises later. Django's bill arrives in a different form: as choices. Which of several ways should this view be written? Which of several front end approaches should this product use? Why did this page run 40 database queries?

I call this the comprehension loan. Rails lends, Django charges up front, and each has its own kind of interest. Keeping it in mind changes three practical decisions:

  • When you schedule the hard learning. With Rails, budget for the wall in weeks two to six. With Django, budget for the slow start and the front end decision.
  • How you evaluate a framework. A two week trial measures the honeymoon, not the wall. You have to test the wall on purpose (I show how below).
  • How you judge a developer. Someone who has only enjoyed the loan can build quickly in Rails and still not know why their code works. The test for real skill is whether they can trace behaviour back to its source.

Example: the first afternoon at Freewheel

Cian has never touched either framework. On his first afternoon he builds the same thing twice: a list of today's bookings.

In Rails he runs one generator, bin/rails generate scaffold Booking starts_at:datetime customer_name:string, then bin/rails db:migrate, and opens /bookings in the browser. There is a list page, a form, an edit page and a delete button. He has written no code and understands almost none of what was generated. He is delighted, and he is in debt, though nobody has told him yet.

In Django he follows the official tutorial's pattern. He runs django-admin startproject freewheel, then python manage.py startapp bookings, adds "bookings" to INSTALLED_APPS in settings.py, writes a model, makes and runs a migration, writes a view function, creates bookings/urls.py, includes it from the project's urls.py, and creates a template at the path the view names. By the end of the afternoon he has one list page, and he could explain every line of it. He is slower, and he owes nothing.

Neither afternoon tells you which framework is better. It tells you when each one will ask Cian to do the hard thinking.

The learning curve is three curves

"Learning Django" or "learning Rails" is really three things learned at once, and they move at different speeds:

  1. The language. Python for Django, Ruby for Rails. Syntax, the standard library, how the language thinks about objects, errors and collections.
  2. The framework. How a request becomes a response: routing, models and the database layer, views or controllers, templates, forms, settings, and the conventions that connect them.
  3. The ecosystem and conventions. Everything a real application needs that the tutorial skims: how tests are written and run, how the application is deployed, which front end approach the team uses, which packages or gems are trusted, how upgrades work.

Most "how long" answers measure only the second curve, and only its first week. The language curve is the shortest for an experienced developer. The ecosystem curve is the longest for everyone, and it is where most real projects lose time.

Example: what Aisling and Cian already carry

Here is what each developer brings to each curve. The point of the table is that experience transfers unevenly.

CurveAisling in DjangoAisling in RailsCian in DjangoCian in Rails
LanguageDone: Python is her daily languageNew: Ruby, but the ideas map from PythonNew: PythonNew: Ruby
FrameworkPartly: Flask taught her routes, views and templatesNew, but Flask concepts still mapNewNew
EcosystemPartly: pip, virtual environments, pytest from data workNew: Bundler, gems, Rails test toolsPartly: he knows package managers and test runners in generalPartly, the same general knowledge
Front endWeak spot: server templates onlyWeak spotStrong if the product uses React, weak if it uses server templatesStrong in principle, but Hotwire works differently from React

Aisling has a head start in Django on two curves out of three. Cian starts roughly level in both. That asymmetry matters more to Freewheel than any general claim about which framework is "easier".

The language curve: Python is far more widely taught, Ruby is smaller but readable

Python is one of the most widely used and taught languages in the world. Ruby is a smaller community. Two independent sources, measured in very different ways, agree on that much.

The Stack Overflow Developer Survey 2023, published on 13 June 2023 with around 90,000 responses, asked which languages people had used in the past year3. Python was used by 49.28% of all respondents and 56.57% of people learning to code. Ruby was used by 6.23% of all respondents and 2.55% of learners. For frameworks, Django was used by 11.47% of respondents and 13.52% of learners, Ruby on Rails by 5.49% and 1.80%. A survey is not a census: it counts the people who answered a Stack Overflow survey, which leans towards people who use Stack Overflow. The direction is still clear.

The TIOBE Index for December 2023 ranks Python first with a rating of 13.86% and Ruby 19th with 0.77%4. TIOBE does not count developers or code. Its rating is built from search engine results for each language, reflecting skilled engineers, courses and third party vendors, and TIOBE itself says it is not about the best language5. Treat it as a measure of how much is written and taught about a language, which is exactly the thing a learner depends on.

What this means for learning:

  • Python has more of everything for a beginner. More courses, more answers to beginner questions, more people around you who already know it. A complete beginner will find Python easier to learn alone.
  • For an experienced developer, the language curve is short in both. Both are dynamic, strongly typed, object oriented languages with closures and a good interactive console. The official "To Ruby From Python" page lists the similarities first: an interactive prompt, lists and dictionaries with familiar brackets, strong and dynamic types, everything an object6.
  • Ruby's differences are small but they bite. The same page lists them: only false and nil count as false, parentheses on method calls are usually optional, you can reopen and change built in classes, mixins replace multiple inheritance, and blocks are everywhere6. Ruby's own site describes the goal as making the language "natural, not simple"7.

Example: Aisling's first Ruby surprise

Aisling writes a check for the nightly parts reorder report: if a part has nothing in stock, flag it. In Python she would write this:

# Python: zero is falsy, so "not in_stock" is True when in_stock == 0
in_stock = 0
if not in_stock:
    print("reorder")  # prints "reorder"

She translates it to Ruby line by line:

# Ruby: only nil and false are falsy, so 0 counts as true
in_stock = 0
puts "reorder" unless in_stock   # prints nothing

Nothing prints. In Ruby, 0 is a perfectly good, truthy object. The Ruby way states the intent instead:

in_stock = 0
puts "reorder" if in_stock.zero?   # prints "reorder"

This is the language curve in miniature. The syntax took her ten minutes. The habits take a few weeks, and the habits are where the bugs hide.

The Rails curve: the first week feels like magic, then comes the wall

Rails is optimised for the first hour and the five hundredth hour. Generators, sensible defaults and a single command to start a server get a newcomer to a working page faster than almost anything else. The official Getting Started guide builds a small blog with articles and comments in one sitting8. It is also honest about the cost: it warns that readers with no Ruby experience will find the learning curve steep, and it calls Rails "opinionated software"8.

Then, somewhere between week two and week six, most newcomers hit the wall. It does not feel like difficulty. It feels like not being able to find things. The behaviour is there, but the code that causes it is not in the file you are reading. Five mechanisms cause almost all of this, and each is documented:

  • Autoloading. Rails 7.1 loads your classes with a library called Zeitwerk. If app/models/booking.rb defines Booking, you can use Booking anywhere without a require. The guide says you do not need, and should not write, a require for it9. File names must match the constants they define. Newcomers from Python, where every name is imported explicitly, look for the import that is not there.
  • Implicit rendering. A controller action that does not call render still renders a template, the one whose path matches the controller and action. The Layouts and Rendering guide names this "convention over configuration in action"10.
  • Methods nobody wrote. An Active Record model does not list its columns. The API documentation states that Active Record objects infer their attributes from the table definition11. Associations such as has_many :bookings add a family of methods. Routes declared with resources :bookings create seven routes and a set of path helpers like edit_booking_path.
  • Callbacks. Code can run automatically before or after a record is validated, saved, created, committed or destroyed. The callbacks guide lists the order for creating a record, from before_validation to after_commit, and warns that methods like update_column skip callbacks entirely12. Behaviour that lives in a callback is invisible from the line that triggered it.
  • Concerns. A concern is a module of shared behaviour, built with ActiveSupport::Concern, that a model or controller includes in one line13. The Getting Started guide introduces one in its refactoring chapter8. Useful, and one more place a method can come from.

None of these is a flaw. Each one removes code you would otherwise write and read every day, which is exactly why experienced Rails developers are fast. David Heinemeier Hansson's Rails Doctrine calls Ruby's powerful features "sharp knives" and argues for trusting developers with them1. The cost is that understanding is deferred. The wall is the moment it falls due.

Example: Cian traces one page

In week three, Cian opens the controller for Freewheel's daily booking list:

# app/controllers/bookings_controller.rb
class BookingsController < ApplicationController
  def index
    # today's bookings, earliest first
    @bookings = Booking.where(starts_at: Date.current.all_day).order(:starts_at)
  end
end

And the model:

# app/models/booking.rb
class Booking < ApplicationRecord
  belongs_to :customer
  belongs_to :mechanic
  has_one :job_card

  # send the confirmation once the booking is safely in the database
  after_create_commit :send_confirmation

  private

  def send_confirmation
    BookingMailer.confirmation(self).deliver_later
  end
end

And part of the template:

<%# app/views/bookings/index.html.erb %>
<% @bookings.each do |booking| %>
  <p>
    <%= booking.starts_at.strftime("%H:%M") %>
    <%= booking.customer.name %>
    <%= link_to "Edit", edit_booking_path(booking) %>
  </p>
<% end %>

He has six questions. Each has a precise answer, and each answer lives somewhere other than the file he is reading:

Cian's questionWhere the answer lives
Where is Booking imported?Nowhere: Zeitwerk autoloads it from app/models/booking.rb
Where is starts_at defined?In the database table, recorded in db/schema.rb, and Active Record infers it
What is Date.current.all_day?Active Support, Rails' extensions to Ruby's core classes
Who renders the template?Rails, implicitly, because the action is index in BookingsController
Where does edit_booking_path come from?resources :bookings in config/routes.rb
Why did a confirmation email go out in my test?The after_create_commit callback in the model

There is a seventh issue he has not noticed yet. booking.customer.name inside the loop runs one query per booking to load its customer. With 200 bookings on a Saturday, that is 201 queries. The Active Record query guide calls this the N + 1 queries problem and fixes it with includes(:customer)14. Django has exactly the same trap, as the next section shows. It is a database lesson, not a Rails one.

On the day Cian can answer all seven without asking, he is past the wall.

The Django curve: a slower first day, fewer surprises, three hard places

Django's official tutorial builds a small polls application in eight parts: a public site for viewing and voting, and an admin site for managing polls15. It assumes you know some Python and points newcomers to Python resources first16.

The first day asks for more concepts than Rails does. The tutorial starts with a distinction many beginners find abstract: a project is "a collection of configuration and apps" for a website, and an app is a web application that does one thing, which can live in several projects15. You meet settings.py, urls.py, INSTALLED_APPS and the manage.py command on the first page. This is the up front charge in the comprehension loan. Once paid, it pays back: when Aisling reads a Django view, the imports at the top tell her where every name comes from, and the URL configuration tells her exactly which view handles which address.

Django is not free of hard places. It moves them. There are three that most newcomers meet.

The ORM's query semantics. Django's object relational mapper (ORM) builds SQL from Python. The documentation states that querysets are lazy: creating one touches no database, and you can stack filters "all day long" until the queryset is evaluated17. That is powerful and confusing in equal measure. When does a query run? Why did slicing run one here and not there? Lookups across relationships use double underscores (customer__name__startswith). And, as in Rails, following a relationship inside a loop runs one query per row unless you ask for select_related or prefetch_related18.

Class based views. Django offers views as plain functions or as classes. Class based views reuse behaviour through inheritance and mixins, and the documentation is candid about the price: the more your code is scattered among mixins, the harder it is to read a child class and know what it does19. Generic views also bring back a little implicitness: a ListView for Booking in the bookings app looks for the template bookings/booking_list.html and exposes booking_list to it, unless you say otherwise20. Fairly put, this is where Django feels most like Rails, and it is where many Django newcomers stall.

Choosing the front end. Rails 7.1 ships one default answer for interactive pages: import maps and Hotwire, which updates pages with HTML sent from the server2122. Django ships server rendered templates and leaves the rest to you. The common paths at the end of 2023 are plain templates, templates with htmx (a small library that lets HTML attributes make requests and swap in server responses)23, or Django REST Framework serving JSON to a separate React or Vue application. Each is valid. The difficulty is not any one of them. It is that a newcomer has to choose before they know enough to choose well, and the choice shapes everything after.

Example: Aisling's booking list, and the query she cannot see

Aisling builds the same daily list in Django, function style:

# bookings/views.py
from django.shortcuts import render
from django.utils import timezone

from .models import Booking


def booking_list(request):
    today = timezone.localdate()
    # lazy: no query runs on this line
    bookings = Booking.objects.filter(starts_at__date=today).order_by("starts_at")
    return render(request, "bookings/booking_list.html", {"bookings": bookings})
# bookings/urls.py
from django.urls import path

from . import views

app_name = "bookings"
urlpatterns = [
    path("", views.booking_list, name="list"),
]

Every name is imported. The template path is written out. The URL is mapped by hand and has a name for reversing. Nothing is hidden, and Aisling likes that.

Her template loops over the bookings and prints {{ booking.customer.name }}. On a busy Saturday the page is slow. She installs a query logger and finds the same N + 1 problem Cian found: one query for the bookings, then one per customer. The query ran in the template, not in the view, because the queryset was lazy and each booking.customer loaded on access. The fix is one call:

bookings = (
    Booking.objects.filter(starts_at__date=today)
    .select_related("customer")  # join the customer in the same query
    .order_by("starts_at")
)

Then she rewrites the view as a class, because the codebase uses them:

# bookings/views.py
from django.utils import timezone
from django.views.generic import ListView

from .models import Booking


class BookingListView(ListView):
    model = Booking
    # template defaults to bookings/booking_list.html
    # context gets booking_list (and object_list)

    def get_queryset(self):
        today = timezone.localdate()
        return (
            Booking.objects.filter(starts_at__date=today)
            .select_related("customer")
            .order_by("starts_at")
        )

Shorter, and suddenly two things happen that no line states: a template is found by convention and a variable appears in its context. Aisling meets a little of Rails' magic inside Django, at exactly the point Django's documentation warns about.

The hard concepts, side by side

Here are the concepts that take newcomers longest in each framework, as I see them, with what makes each one hard and the documentation that explains it.

FrameworkConceptWhy it is hardWhere it is explained
RailsAutoloading with ZeitwerkNames appear without imports, file names must match constantsRails Guides, Autoloading and Reloading Constants9
RailsImplicit renderingThe template that renders is not named anywhereRails Guides, Layouts and Rendering10
RailsAttributes and association methodsMethods exist that no file in the app definesAPI, ActiveRecord::Base11
RailsRoutes and path helpersresources creates routes and helpers in one lineRails Guides, Routing24
RailsCallbacksSide effects run far from the line that triggered themRails Guides, Active Record Callbacks12
RailsConcernsBehaviour is mixed in from a module elsewhereAPI, ActiveSupport::Concern13
DjangoProject versus app, settingsAbstract on day one, many files before the first pageDjango tutorial, part 115
DjangoLazy querysets and lookupsWhen a query runs is not where it is writtenDjango docs, Making queries17
Djangoselect_related and prefetch_relatedTwo tools for two relationship shapesDjango docs, QuerySet API18
DjangoClass based views and mixinsBehaviour spread across a class hierarchyDjango docs, class based views19
DjangoChoosing the front endA design decision forced earlyNo single official answer
BothN + 1 queriesLoops quietly multiply database callsRails querying guide14, Django QuerySet API18
BothMigrationsDatabase changes as versioned codeEach framework's migration guide

Notice the pattern. Rails' hard concepts are mostly "where does this come from". Django's are mostly "which way should I do this" and "when does this happen". Both share the database lessons, because underneath both frameworks it is still SQL.

The ecosystem curve: tests, deployment and the front end

The third curve is the one tutorials skim and real projects live in. It covers the habits around the code.

Tests. Rails ships with Minitest as its default testing library and generates test files with every model and controller25. It also has system tests that drive a real browser. Much of the community uses RSpec instead, so a newcomer meets two styles. Django's built in tests use Python's standard unittest module, with Django's own TestCase running each test inside a transaction26. Many Django teams use pytest with the pytest django plugin instead. Again, two styles. The testing series later in this programme goes through both toolchains in full.

Deployment. New Rails 7.1 applications include a Dockerfile by default21, which makes the path to a container short. Django's deployment guide covers serving the application through WSGI or ASGI, with static files collected separately27. Neither is hard once learned. Both are new to someone who has only ever run a development server.

Packages. Ruby developers manage gems with Bundler and a Gemfile. Python developers manage packages with pip and virtual environments, or with a tool such as Poetry. Aisling already knows pip. Cian knows npm, which helps with the idea but not the details.

The front end. Covered above. For Cian this is the biggest ecosystem question in either framework, because his React experience transfers directly only if the product has a separate React application.

Example: Freewheel's definition of done in week four

Niamh asks, fair enough, what "productive" will mean by the end of the first month. Aisling and Cian agree on a definition, and I would use the same one for any team. A developer is productive when they can take a small feature, for example "a mechanic can mark a job card as ready", and on their own:

  1. write the migration and the model change,
  2. write the controller action or view and the template,
  3. write at least one test that fails first and passes after,
  4. run the whole suite locally and keep it green,
  5. open a change that a reviewer accepts without explaining a framework concept to them.

Step 5 is the honest one. Steps 1 to 4 can be done by copying. Step 5 shows whether the developer understood what they copied.

A realistic timeline, as a reasoned estimate

What follows is my estimate, reasoned from the curves above. It is not measured data, and I am not aware of a rigorous study that measures time to productivity in either framework. Use it to plan, then replace it with what you observe.

For a developer who already works professionally in another language:

PointRailsDjango
Week 1Builds pages with generators, follows tutorials, ships nothing unaidedHas finished most of the tutorial, understands the wiring, slower output
Month 1Through or inside the wall, ships small features with helpShips small features with help, starts meeting query and view questions
Month 3Ships features alone, can trace most behaviour to its sourceShips features alone, has settled on a view style and front end approach
Month 6Reviews others' work, knows when to use and avoid callbacks and concernsReviews others' work, reads query plans, structures apps cleanly

For a complete beginner, the timeline stretches, and the order changes. A beginner has to learn programming itself first: variables, functions, loops, how a web request works, what a database is. That alone is a matter of months. Python's larger body of beginner material makes that stage easier to do alone. Rails' first week magic is a double edged gift for a beginner: it produces impressive results before they can tell the framework's work from their own. My estimate for a beginner reaching the month 3 level above is closer to nine to twelve months, in either framework, with a mentor making a far larger difference than the framework choice.

Illustrative model, not measured data, for an experienced developer new to both language and framework. Share of normal output by week. Rails starts higher at 30% in week 1 and 45% in week 2, dips to 40% in week 4 at the wall, then climbs to 88% by week 26. Django starts lower at 20% in week 1, climbs steadily, flattens around weeks 8 to 12 at 62% to 68% while the front end and view style are settled, and also reaches 88% by week 26. Tap or click to enlarge

The two lines end in the same place. They differ in shape, and the shape is the point: Rails gives early and asks for it back around the wall, Django gives later and then flattens while the big choices are made.

The learning tax: what the curve costs in a six month budget

A curve is easier to reason about once it has a price. I call the price the learning tax: the developer weeks lost to learning, compared with someone already fluent. If a developer produces 60% of their normal output in a given week, that week carries 0.4 weeks of tax.

Split the six months into phases and add them up. This is a weighted sum, the same idea as an average weighted by time (Foundations: ratios and rates, and the mean for averages):

T=∑ini (1−pˉi)T = \sum_{i} n_i \,(1 - \bar{p}_i)

where TT is the learning tax in developer weeks, ii numbers the phases, nin_i is the number of weeks in phase ii, and pˉi\bar{p}_i is the developer's average share of normal output during phase ii, between 0 and 1.

The share of the budget lost is then a simple ratio (Foundations: ratios and rates):

S=TteamBS = \frac{T_{\text{team}}}{B}

where SS is the share of the budget, TteamT_{\text{team}} is the sum of every developer's learning tax, and BB is the budget in developer weeks.

Example: Freewheel's four combinations

Freewheel's budget is six months for two developers: 26 weeks each, so B=52B = 52 developer weeks. I use four phases: weeks 1 to 2 (n1=2n_1 = 2), weeks 3 to 6 (n2=4n_2 = 4), weeks 7 to 12 (n3=6n_3 = 6) and weeks 13 to 26 (n4=14n_4 = 14). The productivity shares are my estimates, reasoned from what each developer brings:

Developer and frameworkWeeks 1 to 2Weeks 3 to 6Weeks 7 to 12Weeks 13 to 26
Aisling in Django0.550.700.800.90
Aisling in Rails0.350.450.700.90
Cian in Django0.250.500.650.85
Cian in Rails0.300.400.700.85

Aisling in Django starts high because Python and Flask transfer. Aisling in Rails dips in weeks 3 to 6, the wall. Cian starts low in Django because both Python and the explicit wiring are new, and starts a little higher in Rails thanks to the generators, then hits the wall.

Aisling in Django:

T=2(1−0.55)+4(1−0.70)+6(1−0.80)+14(1−0.90)=0.9+1.2+1.2+1.4=4.7T = 2(1 - 0.55) + 4(1 - 0.70) + 6(1 - 0.80) + 14(1 - 0.90) = 0.9 + 1.2 + 1.2 + 1.4 = 4.7

where each term is ni(1−pˉi)n_i (1 - \bar{p}_i) for one phase, so T=4.7T = 4.7 developer weeks.

Aisling in Rails:

T=2(0.65)+4(0.55)+6(0.30)+14(0.10)=1.3+2.2+1.8+1.4=6.7T = 2(0.65) + 4(0.55) + 6(0.30) + 14(0.10) = 1.3 + 2.2 + 1.8 + 1.4 = 6.7

where the brackets now show 1−pˉi1 - \bar{p}_i already worked out, so T=6.7T = 6.7 developer weeks.

Cian in Django:

T=2(0.75)+4(0.50)+6(0.35)+14(0.15)=1.5+2.0+2.1+2.1=7.7T = 2(0.75) + 4(0.50) + 6(0.35) + 14(0.15) = 1.5 + 2.0 + 2.1 + 2.1 = 7.7

where again each bracket is 1−pˉi1 - \bar{p}_i, giving T=7.7T = 7.7 developer weeks.

Cian in Rails:

T=2(0.70)+4(0.60)+6(0.30)+14(0.15)=1.4+2.4+1.8+2.1=7.7T = 2(0.70) + 4(0.60) + 6(0.30) + 14(0.15) = 1.4 + 2.4 + 1.8 + 2.1 = 7.7

where the same arithmetic gives T=7.7T = 7.7 developer weeks.

So the team's tax is 4.7+7.7=12.44.7 + 7.7 = 12.4 developer weeks in Django and 6.7+7.7=14.46.7 + 7.7 = 14.4 in Rails. As a share of the budget (Foundations: percentages):

SDjango=12.452≈24%,SRails=14.452≈28%S_{\text{Django}} = \frac{12.4}{52} \approx 24\%, \qquad S_{\text{Rails}} = \frac{14.4}{52} \approx 28\%

where SS is the share of Freewheel's 52 developer weeks lost to learning in each framework.

Illustrative estimate. Aisling loses 4.7 developer weeks in Django and 6.7 in Rails. Cian loses 7.7 in either. The team total is 12.4 developer weeks in Django and 14.4 in Rails, out of a budget of 52. Tap or click to enlarge

Three things follow, and they are the useful part.

First, the learning tax is large in both: about a quarter of the first six months. Any plan that assumes full speed from week one is wrong before it starts, whichever framework wins.

Second, the difference between the two is about two developer weeks, roughly 4% of the budget. It comes almost entirely from Aisling's Python. That is real, and it is also small next to the five year costs the fifth chapter of this series looks at: upgrades, hiring and maintenance.

Third, timing matters more than the total. Rails' tax is concentrated in weeks 3 to 6, right when Freewheel would be building the booking flow. Django's is spread more evenly, with a flat stretch around the front end decision. A project manager who knows where the dip falls can schedule around it: put the well understood work in the dip, and the risky work after it.

Test the wall, not the honeymoon

Freewheel plans to build a two week spike of the core, booking and the workshop board, in both frameworks before deciding. That is a sound idea with a hidden bias. A two week spike measures the first two weeks. In Rails, those are the honeymoon. In Django, they include the slow start. Left alone, the spike flatters Rails and undersells Django.

The fix is to put one deliberate wall task into each spike: the thing that framework's newcomers find hardest, done on purpose while someone experienced can help.

Example: the wall tasks in Freewheel's spikes

In the Rails spike, Cian and Aisling add a callback that sends the booking confirmation, move the "is this booking in the past" logic into a concern shared by Booking and JobCard, and update the workshop board through a Turbo Stream. Then each of them answers the seven questions from the trace table above, for code the other one wrote, without looking anything up for the first five minutes.

In the Django spike, they rewrite the booking list as a ListView, add a related field and find and fix the N + 1 query with the query log open, and make the workshop board update with htmx. Then each explains, for code the other wrote, which queries a page runs and when.

The spikes now measure how each developer copes with the hard part, which is what the six months will actually be made of. How Freewheel weighs the results is the subject of the sixth chapter, on a decision method.

What to learn first, and what to postpone

Order matters as much as effort. Learning the right thing at the wrong time is how a month disappears.

Learn first, in Rails:

  1. enough Ruby to read blocks, symbols, hashes and truthiness,
  2. the request path: route, controller, view,
  3. Active Record basics and migrations,
  4. the conventions behind autoloading and implicit rendering, on purpose, in week one rather than discovering them in week four,
  5. Minitest and one system test.

Postpone in Rails: metaprogramming of your own, writing concerns, Action Cable, complex Stimulus controllers, and any gem that replaces a Rails default. Use the default until you know why you would leave it.

Learn first, in Django:

  1. Python basics, if needed,
  2. project, app, settings and URL configuration,
  3. models, migrations and the admin,
  4. function based views and templates,
  5. querysets, laziness and select_related,
  6. the built in test runner.

Postpone in Django: class based views beyond ListView and DetailView, custom mixins, signals, custom managers, Django REST Framework (unless the product needs an API on day one), and the front end decision beyond plain templates until the first feature works end to end.

Two rules apply to both. Learn the database lessons early, because N + 1 queries and missing indexes hurt in either framework. And learn the testing tool in the first month, because every later week is faster with tests.

Tap or click to enlarge

Example: Aisling's next step after her first Rails week

At the end of week one in Rails, Aisling can generate a model, write a controller action and render a list. She walks the flow. Can she say where every line on her page gets its behaviour? Not yet: she does not know where edit_booking_path comes from. So she reads the routing guide's section on resources and runs bin/rails routes to see the generated list. The next question: can she see every query? She opens the development log, which in Rails prints each SQL query, and spots the N + 1. She adds includes(:customer). Then tests: she writes a model test for the "is in the past" rule before writing the method. Only then does she touch Hotwire.

A week by week plan for Freewheel

Here is how I would plan Freewheel's first two months, in either framework. It is my suggested plan, not a fixed recipe.

WeekBoth developersAisling's focusCian's focus
1Official tutorials: the Rails Getting Started guide and the Django tutorial, parts 1 to 4Ruby from Python differences, Ruby quickstartPython tutorial, then Ruby quickstart
2 to 3First spike: booking and workshop board, plus its wall tasksModels and queriesTemplates and the live board
4 to 5Second spike in the other framework, plus its wall tasksSwap roles: Aisling on the boardCian on models and queries
6Decision week: compare, score, decide (chapter 6)
7 to 8Build the real booking flow test first in the chosen framework, with the trace test at the end of week 8Booking rules and slot logicWorkshop board and job cards

The swap in weeks 4 to 5 is deliberate. Each developer should feel both the data side and the interface side of each framework, or the evaluation compares the developers instead of the frameworks.

For books alongside the official material, three are current and fair choices at the end of 2023. Agile Web Development with Rails 7 by Sam Ruby and Dave Thomas, Pragmatic Bookshelf, May 2023, builds a shop through the framework28. Django for Beginners by William S. Vincent, updated for Django 4.2 in 2023, builds several projects and covers testing and deployment29. Python Crash Course, third edition, by Eric Matthes, No Starch Press, December 2022, teaches Python from scratch and ends with a Django project, useful for Cian30. Django 5.0, released on 4 December 2023, changes little a beginner meets in those chapters31. Rails 7.1, released on 5 October 2023, is the version the Rails book's lessons carry straight into32.

How to judge a developer's real level

CVs say "three years of Django" or "Rails expert". Neither tells you whether the person is past the wall. Three short exercises do, and they work in both frameworks.

The trace test. Give the candidate a page of real code they did not write and ask, for each interesting line, where the behaviour comes from. In Rails: the route, the autoloaded constant, the callback, the concern, the helper. In Django: the URL configuration, the view's parent classes, the template lookup, the moment the queryset runs. A developer past the wall answers quickly and says "let me check" for the rest, then knows exactly where to check.

The query test. Show a list page and its development log. Ask how many queries it runs and how to reduce them. This separates people who have built real pages under load from people who have built tutorials.

The "why not the default" question. Ask about one default they would change and one they would never change. In Rails: when they would avoid a callback, or why they would keep Minitest or move to RSpec. In Django: when they would choose a function view over a class, or how they would pick between templates, htmx and a separate front end. Good answers name a trade off. Weak answers name a preference.

Example: the trace test on Cian at the end of the Rails spike

On the last day of the Rails spike, Aisling runs the trace test on Cian with eight lines from the booking code she wrote. Cian answers six straight away. On the seventh, a method on Booking he cannot find, he says it is probably from a concern and checks the include lines at the top of the model: correct. On the eighth he says a confirmation is sent "somewhere in the mailer", which is right but not the question. The question was what triggers it. Aisling points him to the callback. Verdict: past the wall, with one gap to close. The test took 20 minutes and told Niamh more than a week of status updates.

For the person paying for this

If you commission a web application, here is what this chapter means for your budget and your conversations:

  • Expect a learning tax of roughly a quarter of the first six months when your developers are new to the framework, in either framework. Ask to see it in the plan. A plan with no dip is optimistic, not efficient.
  • The difference between the frameworks on learning is small. In the Freewheel example it was about two developer weeks out of 52. Do not let it decide the framework on its own.
  • Ask when the dip falls. In Rails it tends to come in weeks two to six. In Django it tends to come with the early front end and view decisions. Schedule your demos and deadlines with that in mind.
  • Ask for the trace test. Whoever builds your application, ask a developer to explain, line by line, where one page's behaviour comes from. If they cannot, they are still paying off the loan with your money.

If you want a second pair of eyes on a plan like this, I run a free workshop where we look at your team, your product and the first six months together. For the kind of applications I build, see web application development.

My view

My view: the honest learning curve is about the same length in Django and Rails for an experienced developer, and it is the shape that differs. Rails gets a newcomer productive sooner and asks for understanding later, at the wall. Django asks for understanding sooner and spends it later on choices. Neither is easier. They are easier at different times.

Three judgements follow, and they are mine, not documented fact. First, language background matters more than framework design: a Python developer starts Django with a real head start, and that head start is worth weeks, not months. Second, for a complete beginner, Python's far larger body of learning material is a genuine advantage, and a mentor is worth more than either framework. Third, most teams evaluate frameworks during the honeymoon. Test the wall on purpose and the comparison becomes fair.

I build on Rails because, for the products I make, the conventions pay back for years after the loan is repaid. That is a reason to choose Rails once you are past the wall. It is not a claim that the wall is lower.

Conclusion

Learning Django or Rails is three curves at once: the language, the framework and the ecosystem. Python is taught far more widely than Ruby, which helps beginners most. Rails front loads the reward and back loads the understanding, so expect the wall between weeks two and six, caused by autoloading, implicit rendering, generated methods, callbacks and concerns. Django front loads the wiring and back loads the choices, so expect a slower first week and harder questions around querysets, class based views and the front end. Both share the database lessons.

Plan for a learning tax of about a quarter of the first six months, put the wall on the schedule, test the wall in any evaluation, and judge developers by whether they can trace behaviour to its source. The framework decision itself belongs to a method, not a learning curve. That is where this series goes next, after a look at what each costs to run, hire for and keep up to date.

If you are planning a new web application and want the learning curve on the schedule instead of in the overrun, book the free workshop: we map your team's first six months together, and the first two weeks of work are on me.

Sources

  1. 1.

    David Heinemeier Hansson, The Rails Doctrine, Ruby on Rails, 2016, https://rubyonrails.org/doctrine

  2. 2.

    Django Software Foundation, Design philosophies, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/misc/design-philosophies/

  3. 3.

    Stack Overflow, Stack Overflow Developer Survey 2023, published 13 June 2023, https://survey.stackoverflow.co/2023/

  4. 4.

    TIOBE Software, TIOBE Index for December 2023, December 2023, archived 18 December 2023, https://web.archive.org/web/20231218040738/https://www.tiobe.com/tiobe-index/

  5. 5.

    TIOBE Software, TIOBE Programming Community Index Definition, https://www.tiobe.com/tiobe-index/programminglanguages_definition/

  6. 6.
  7. 7.

    Ruby community, About Ruby, ruby-lang.org, https://www.ruby-lang.org/en/about/

  8. 8.

    Ruby on Rails Guides (v7.1), Getting Started with Rails, https://guides.rubyonrails.org/v7.1/getting_started.html

  9. 9.

    Ruby on Rails Guides (v7.1), Autoloading and Reloading Constants, https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html

  10. 10.

    Ruby on Rails Guides (v7.1), Layouts and Rendering in Rails, https://guides.rubyonrails.org/v7.1/layouts_and_rendering.html

  11. 11.

    Ruby on Rails API (v7.1), ActiveRecord::Base, https://api.rubyonrails.org/v7.1/classes/ActiveRecord/Base.html

  12. 12.

    Ruby on Rails Guides (v7.1), Active Record Callbacks, https://guides.rubyonrails.org/v7.1/active_record_callbacks.html

  13. 13.

    Ruby on Rails API (v7.1), ActiveSupport::Concern, https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Concern.html

  14. 14.

    Ruby on Rails Guides (v7.1), Active Record Query Interface, section on eager loading and the N + 1 queries problem, https://guides.rubyonrails.org/v7.1/active_record_querying.html

  15. 15.

    Django Software Foundation, Writing your first Django app, part 1, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/intro/tutorial01/

  16. 16.

    Django Software Foundation, Getting started, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/intro/

  17. 17.

    Django Software Foundation, Making queries, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/topics/db/queries/

  18. 18.

    Django Software Foundation, QuerySet API reference, select_related and prefetch_related, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/ref/models/querysets/

  19. 19.

    Django Software Foundation, Introduction to class based views, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/topics/class-based-views/intro/

  20. 20.

    Django Software Foundation, Multiple object mixins, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/ref/class-based-views/mixins-multiple-object/

  21. 21.

    Ruby on Rails Guides (v7.1), Ruby on Rails 7.1 Release Notes, https://guides.rubyonrails.org/v7.1/7_1_release_notes.html

  22. 22.

    Ruby on Rails Guides (v7.1), Working with JavaScript in Rails, https://guides.rubyonrails.org/v7.1/working_with_javascript_in_rails.html

  23. 23.

    htmx, Documentation (version 1), https://v1.htmx.org/docs/

  24. 24.

    Ruby on Rails Guides (v7.1), Rails Routing from the Outside In, https://guides.rubyonrails.org/v7.1/routing.html

  25. 25.

    Ruby on Rails Guides (v7.1), Testing Rails Applications, https://guides.rubyonrails.org/v7.1/testing.html

  26. 26.

    Django Software Foundation, Writing and running tests, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/topics/testing/overview/

  27. 27.

    Django Software Foundation, How to deploy Django, Django 5.0 documentation, https://docs.djangoproject.com/en/5.0/howto/deployment/

  28. 28.

    Sam Ruby and Dave Thomas, Agile Web Development with Rails 7, Pragmatic Bookshelf, May 2023, https://pragprog.com/titles/rails7/agile-web-development-with-rails-7/

  29. 29.

    William S. Vincent, Django for Beginners, Django 4.2 edition, 2023, code repository as of 2023, https://github.com/wsvincent/djangoforbeginners/tree/4d3ae7b56c82aa993849ee73f2c7f5790752c8a0

  30. 30.

    Eric Matthes, Python Crash Course, third edition, No Starch Press, December 2022, https://nostarch.com/python-crash-course-3rd-edition

  31. 31.

    Django Software Foundation, Django 5.0 released, Django weblog, 4 December 2023, https://www.djangoproject.com/weblog/2023/dec/04/django-50-released/

  32. 32.

    Ruby on Rails, Rails 7.1.0 has been released, rubyonrails.org, 5 October 2023, https://rubyonrails.org/2023/10/5/Rails-7-1-0-has-been-released

Shelter

I’m running the London Marathon for Shelter. Sunday 25 April 2027

My personal fundraiser. Shelter, the National Campaign for Homeless People Limited, registered charity 263710 (England and Wales) and SC002327 (Scotland), registered with the Fundraising Regulator.

Donate to Shelter