By BoLOBOOLNE payday loans

Choosing a web framework: Python, Django vs. Ruby on Rails

One of my responsibilities in my new job is to lay the groundwork for development of the company’s technology.  One decision that was pretty easy to make is that we’ll be building tools that you can use from a web browser, that is to say, a web application.  Next comes the choice of what language and framework to build the web application in.

Having been writing code for 25+ years, the differences between programming languages fade away in my mind.  I know that I, like any good software engineer, can be productive in basically any language.  Certainly within object-oriented languages, (which is where essentially all serious software engineering happens these days) the differences in the language itself are IMHO small compared with other factors in choosing a platform.  Other important factors I consider include:

  • Quality and availability of libraries.
  • Quality of tools like IDEs, debuggers, automation systems.
  • Size and healthy of the active community using the framework.  (i.e. If I run into a problem, how easy is it to google the answer?)
  • Ease of hiring people who already know the platform.

All of these considerations are IMHO more important than compiled vs. interpreted or run-time performance or whether the language is statically typed or dynamically typed, or even if it’s open source vs. proprietary technology.  But there is a single common factor which directly feeds into all four of the criteria I list above: How many people are actively using the platform?

The Candidates

The last time I was really writing much code was back in 2007.  At the time Ruby on Rails was the coolest thing since sliced bread.  I played around with it, was amazed by how easy it was to quickly put together simple database-driven websites, and got very frustrated with it when I wanted to color outside of its lines.  A major concern of mine was the level of “magic” that happens behind the scenes — this makes Rails beautiful and elegant when it works, but difficult to debug or extend.  I blogged about my experiences with rails and in particular my conclusion that at the time Rails was not ready for large, complex projects, partly because of a lack of good tools, libraries and sensible error messages, all of which can be fixed by more users.

Around then I started working for Google and stopped writing code.  The next year or so saw a couple big things happen for Ruby on Rails.  Twitter famously had trouble maintaining even 99% uptime (fail whale anybody?), and everybody knew they were running on Ruby on Rails.  Also, Google launched AppEngine, which supported Python, not Ruby, and pointed people like me to an alternative high-level web framework: Django.

So now, in 2010, I return to the fray, and I’m trying to decide between the two frameworks.  There are of course other alternatives, but for the purpose of brevity, I’ll leave out my process of reducing my choices to these two: Rails or Django?

[Update: Commenters point out correctly that PHP has its own MVC frameworks, the most popular of which I believe are CodeIgniter and CakePHP.  While PHP is vastly more popular than either Django or Rails, none of its MVC frameworks come close in terms of popularity, and raw PHP is not comparable in terms of sophistication.]

Measuring community activity

I often use Google Trends to measure relative interest in technologies.  My time is very valuable, so even downloading something and reading its documentation is an investment I’d rather shortcut if I can.  This crude measure of relative search activity can actually be quite telling, and has saved me a bunch of time in choosing packages.

The relative values are hard to take literally since “django” as a single word search query will naturally be higher than a 3-word query like “ruby on rails”, but the search for “rails” by itself will clearly have lots of irrelevant searches.  Likewise, some people searching for “Django” won’t be looking for the web framework, but rather the guitarist or the movie or what-have you.

But it is clear that search activity for Ruby on Rails peaked in 2007-2008 and has been declining since then, while Django has been on a steady upwards trend.  [2012 update: We shouldn't consider this too strongly though since the Django trend is probably due to non-python versions of the term, and honestly both have been pretty flat in recent years.]

Elsewhere I can find evidence that Rails is still a more used platform.  Stackoverflow has twice as many questions about Ruby on Rails vs Django: 13,882 versus 7,496.  To me this indicates pretty clearly that Rails is more active than Django.  Either that or Rails is more confusing and people ask more questions about it, but I doubt that.  [2012 update: now the numbers are 66,845 vs 29,570, continuing the trend.]

The Tiobe Index attempts to objectively measure activity across programming languages.  By its easily manipulated measure, Python has twice the activity of Ruby, independent of the django / rails frameworks, with both languages in decline.

Meanwhile it’s easy to find comparisons on the net between the two.  Everything from content-free videos to people declaring rails dead, and everything in between.

On balance, I find the stackoverflow numbers the most compelling, unbiased indication that Ruby on Rails has more activity than Django / Python.  Even though I’ve been frustrated by it in the past, by my own objective criteria, that seems to make Rails a better choice for building a new web application.

What’s your opinion?

If you have experience with both frameworks, I’d love to hear your experiences.  Please leave a comment.

  1. Eric says:

    Being both a programmer and a gypsy jazz guitarist, I know for a fact that Django Reinhardt and the whole gypsy/manouche music has been increasingly popular in the last few years. So indeed, the google trend graph probably is not a good representation.

  2. Nazer says:

    Maybe one of the Django apps/extensions can become mature enough in the “WordPress friendly default experience” department? This could then become the entry point for beginners.

  3. leodirac says:

    As a Django professional, I really want to see Django’s popularity take off. But I honestly think the project needs to shift its attitude a bit before that will happen.

    IMHO the default experience is too barren. Too often useful features are not included or enabled by default with a note in the documentation saying “to accomplish this task, you just need to override/extend this part of the framework.” The thankfully-almost-dead discussion about whether or not auto_now_add should be removed is a clear example of this. One big reason it survived is because it’s legacy, not because it’s consistent with Django’s philosophy. This is wrong. The framework should include more useful shortcuts that make life easier, rather than relying on developers figuring out how to extend the framework. While it maintains some abstract sense of purity, it raises the barrier to building websites, which is a horrible trade-off to make.

    Django should look to Rails’ scaffolding for clear lessons about how to make the framework easier to get started with.


  4. Nazer says:

    Recents trends on website search show very interesting results:,

    Since November 2010 Rails is really dipping and if Django continues its trend then 2011 will be the year that Django became bigger than Rails.

  5. Richard says:

    Django has atleast a dozen different meanings. The most prominent being a famous Jazz guitarist after whom the framework is named.

    Instead of Google Trends try Google Insights and choose the category as “Computers & Electronics”. Here’s the link:

    And If you see job trends Rails is far ahead:

  6. todd says:

    # of python programming blogs 331,000
    # of ruby programming blogs 327,000
    # of “ruby on rails” programming jobs 556,000
    # of python django programming jobs105,000
    # of python django programming 1,010,000
    # of ruby rails programming 1,290,000

  7. Harold says:

    Check out the comparison with Zend:,+ruby+on+rails,+zend,+django&ctab=0&geo=all&date=all&sort=0

    Zend follows the exact same curve as Django. Quite interesting as I do not know what to make of that: do emerging frameworks follow similar trends?

  8. james says:

    “codeigniter” and “kohana” have also shown strong growth while “cake php” has been in downtrend like “ruby on rails”

  9. james says:

    well the search terms “django python” and “ruby on rails” show different trends. “ruby on rails” has been in downtrend since 2006. “django python” has been in uptrend in the same period, and pretty much sideways for 2009-2010.

  10. Moustache Mike says:

    Too many factors are left unconsidered in this comparison. Primarily the demographics and nature of Stack Overflow and Rails/Django.

    One could imagine, for example, that activity of the community is not the only thing that affects the number of questions regarding it. Perhaps (let’s say) Rails attracts a different audience, one that is more likely to ask questions or need help. Not to sound like I’m claiming Django users ‘know what they’re doing’ moreso than Rails users (I’m in the process of making the choice between the two myself), but Rails is arguably more accessible/easier to pick up.

    All academic, however, as I find the idea of popularity as an indicator of quality to be ridiculous in principle. There are many popular and objectively awful things.

    If you think “number of Stack Overflow posts” determines quality then I’d ask why you’re even bothering with Python or Ruby when you have a clear winner in PHP.

  11. Caffeinated says:

    you can also scale up-front horizontally with varnish and have less apache servers. varnish has some edge-side includes too, for some dynamic stuff not totally dependent on apache/rails/whatever.

    For the elephant in the room check out drupal and community. What do you need to do and is it in the box already?

  12. Pavelr says:

    By the way, another possible comparison is to look at the amount of “likes” in the respective Facebook pages. RoR has 2 “popular” pages, totaling at about 8,500 likes (Some likes may overlap, but the bigger group alone has about 5000 of them). Django has a single popular page with about 3,200 likes.

    A win for rails.

  13. leodirac says:

    @Lambodar Unladen swallow and GIL are just about runtime performance, right? I didn’t go into this much above, but I really don’t care about runtime performance.

    For web development frameworks, runtime performance is IMHO very close to the least important criterion, about as relevant as the color of the mascot’s icon. Any ORM-based web framework (rails, django, many more) scales identically — horizontally on the front end with more servers and vertically on the backend with a bigger DB machine. You can keep scaling this way for a very long time with little engineering effort. Consider that one software developer’s salary can pay for a fleet of servers with 1,000 CPU cores. Please do not waste developers’ time trying to save 10 or 200 CPU cores with a more efficient framework.

    By the time your service is so big that simple horizontal front/vertical back scaling stops working, or you’re shelling out more on servers than you can afford, your service will be a massive success. It might not be a household name everywhere, but it certainly will be in silicon valley.

    Right now golang fails miserably on all four of my criteria: library, tools, community and hiring. This certainly might change, but it will take years.

    @Alan PHP is the elephant in the room. I know very little about it. High time I change that.

  14. Lambodar says:

    Hi Leo,

    My Gut says ‘Go for Ruby on Rails’ in future.

    Particularly after the death of Unladen Swallow project, Ruby and RoR becomes a natural choice for human beings.

    Also, Ruby next version promises removal of GIL and promotion of MP modules. Further, you anyway know that Ruby 1.9 is fast enuf for moderately complex tasks. It’s just time for more libraries and that depends on more users.

    Finally, keep a watch on Golang too. It’s libraries are increasing at a faster rate and hence you may have a rich GO web framework soon.

    Cheers have a egg

  15. Alan S says:

    And of course there is a small elephant in the room here:,+ruby+on+rails

  16. Alan S says:

    I always used to follow rails vs python popularity by the old dead tree index – publishing companies track this stuff much better than we can, and by this measure, Rail’s growth has been slowing and Django’s accelerating to reach roughly a third of that of Rails, and it’s acceleration looks to have been stabilising.

    Another telling measure is to Google Trends “Rails API” vs “Django API”. It’s something people are likely to google periodically while working on a project when not yet so committed to a framework that they’re totally on top of it.

    It gives a similar picture: Rails in slow decline up to 2010, Django hitting Google Trends significance in 2010, and both being fairly stable from then on with Rails about 3 times ahead.

    Looks like typical post-hype stabilisation to me, recovering from that silly time around 2007-09 when people kept switching to Rails for wholly unsuitable projects just because it was the done thing.

  17. leodirac says:

    @chewy If not quality then what do you think determines the popularity of a framework? Popularity begets popularity because it leads to improvements in quality through a variety of mechanisms. Open source projects get more direct contributions, proprietary projects inevitably get more investment as they get more popular.

    I’m honestly not sure what other factors you think might be at play. Do you think there are some hidden gems which nobody knows about but are better than everything else? Amazing platforms that only you and few other people know about which make you vastly more productive than every other software developer out there? Sorry, I just don’t buy it. This industry is way too competitive and way too results-oriented for that kind of thing to last more than a few months.

    Or do you think _the man_ is telling us what to use and we have no choice? Where the man would be who? Microsoft? Or maybe 37signals? I’m not seeing it. The software tools market is not perfectly efficient economically, but I’d argue it’s close.

  18. chewy says:

    moronic article – the popularity of a framework, which is unclear by your own research – has nothing to do with which is better. youre a tool.

  19. leodirac says:

    @BlueSherpa It’s a bit tough to compare apples to apples on that one. Independent of Django or Rails, Python is clearly a more mature, established language than Ruby with better libraries and tools. But because Rails is so important in Ruby-land, the tools that do exist for Ruby tend to be more focused on helping you solve the kinds of problems you’re likely to encounter when using Rails, making it potentially easier to find something that will get the job done.

  20. BlueSherpa says:

    I agree with Sayth’s comment. Were you able to find anything while researching differences in libraries and development tools?

  21. leodirac says:

    It occurs to me now that a relatively fair comparison would be between “rails docs” and “django docs”. Unfortunately neither of those are common enough to show up in google trends.

  22. Aaron H. says:

    The Google analytics approach is severely flawed.

    You say in the comments that you don’t search for “django web” which I’m sure is true. But aside from the first time I heard of RoR wanted to learn more, I’ve never searched for “ruby on rails.” When I search for Rails info I only use the word Rails (or Ruby if it is language specific). By the time I add in another relevant search word I’m never going to get something about trains or jewelry and most sites aren’t likely to use the full term either.

    Also, look at the “News Reference Volume” lines. Django has WAY more hits than “Ruby on Rails” and I’m pretty sure those have more to do with the jazz musician or billiards player.

    Doing things like “django python” or “ruby rails” I think is probably more accurate (and way more in favor of rails with django closing), but still pretty flawed. Even plain “django” against “ruby rails” (no “on”) is quite different from your graph.

    A good article nonetheless, but I wouldn’t weight the trends thing too heavily.

  23. leodirac says:

    Searching google trends is just one factor I considered, and it is imperfect as I said. But all of those factors are strongly correlated with the general idea of “activity” with the system, which is one thing trends measures. More activity will tend over time to improve all the criteria I’m interested in.

    Comparing google trends between “rails error” and “django error” is an interesting idea. Rails comes up about twice as much, with the historical trends being hard to evaluate. Does that mean more people are using it, or that it’s harder to use? Or both?

  24. Sayth says:

    My concern at looking at loose ended statistics is that it is unclear what exactly you are measuring. You seem also to have missed to take into account your won concerns.

    “Other important factors I consider include:

    •Quality and availability of libraries.
    •Quality of tools like IDEs, debuggers, automation systems.
    •Size and healthy of the active community using the framework. (i.e. If I run into a problem, how easy is it to google the answer?)
    •Ease of hiring people who already know the platform”

    How did searching google trends take on board these concerns? Maybe searching “Django error” and “Ruby on Rails Error” might indicate the level of frustration users are having.

  25. Zed says:

    Statistics is lies. Be impulsive, just throw a coin!

  26. leodirac says:

    False positives are certainly a problem with searches for “django”. “Django web” would be more precise and specific, but I don’t think it would be more accurate. I do a lot of searches for django-related material, and I never include the word “web” because I don’t have to, so I doubt others do either. Googling for just “django” returns mostly information about the web framework.

    Regardless, google trends is just one tool for comparing popularity.

  27. Spyro7 says:

    To get a more accurate view of the competition between django and rails, you should use `django web` rather than just `django`. Otherwise, you just get a lot of false positives for the jazz musician.

  1. [...] if you’re consider rails for a new project, my post on whether Django or Rails is more popular has been getting a lot of interest lately. reddit_url = [...]