Skip to content

Comment on Django 1.5 beta release notes

Comments

Can someone point me to a compare/contrast sort of doc between modern Django and Rails? I don't do a lot of web app programming, but I'm curious as to whether there's much of a difference between the two.

There are two non technical differences that I think are worth knowing about. Both are good frameworks although Rails is probably quicker to get started with I suspect it may be harder to become really advanced in.

1) Stability vs Development Speed

The Rails (and it seems Ruby) attitude seems to be that fairly frequent compatibility breaking changes are OK. Bundler and a well managed Gemfile (and probably RVM too) allow you to progress at a slower rate on any Gems that haven't been updated.

The Django (and Python) world seems much more careful about not making breaking changes. In other comments this thread the slow deprecation of old Pythons in Django is mentioned. For Python itself Python 3 was I think regarded as the one chance to break things before locking down compatibility to not change very much going forwards.

2) Documentation

I find the Rails Documentation pretty poor at the details such as explaining exactly what all the valid options are and their effects. Links to the source are often given in the API docs but there are often so many layers of indirection to drill though to find what options are actually supported that the value is limited. There are plenty of examples (e.g. Railscasts) to copy and learn from to get you going on hundreds of different topics but you need these resources to guide you through the massive universe.

Django is more traditionally thoroughly documented but without the really quick 'get something running in 10 minutes' guides. I think once you get proficient you could just look up what you need and it is all there for you but there is quite a lot to learn at the start.

So in my view: Rails - quick start, learn by examples, lean on package management systems heavily. Django - slightly slower start, properly documented in the details, stable long term platforms.

One other BIG difference (significant enough to drive me to Rails, even though I prefer Python to Ruby), is that Rails 3.x has a lot of very nice "quality of life" features that django is lacking.

* Baked in migrations. * The asset pipeline

Honestly those two things alone are MAJOR headache savers.

Django and Ruby 2.x are probably more or less equivalent, but Rails 3.x (and especially the upcoming 4.x, with very cool things like cache digests) are just more modern.

http://batsov.com/articles/2011/06/19/django-vs-rails/ appears to give a quick breakdown, but also misses some key features in my opinion. I've worked with rails for about 5 years and Django for a little over 16 months now. There's some things I do and don't like respectively for each framework.

I suggest testing each out and see which you prefer. Ruby and Python are similar languages but different enough that you'll want to spend some time learning each. Both will benefit you in the long run, as I work with ruby and python daily and is useful knowing both.

I will warn you that Django was easier for me to pick up than rails. Rails guys (me included) tout how easy it is to get going with rails, which is true. However, getting really good with rails is hard. Knowing exactly what's going on and why, how to extend ActiveModel or ActionController properly, monkey patching, proper testing practices, etc are quite the time sink, albeit a beneficial one in my opinion. I think if you have TDD or a client adamant about full test coverage, I've found rails support and practices are more flushed out than django's take.

EDIT: typos

Perfect, thank you.

Rails is written in Ruby, and Django in Python. That's by far the biggest (and maybe only) difference.

That certainly is a big distinction, but is not the only difference.

An older overview is available here: http://www.vaporbase.com/rails-django

Sure. But, for instance, is Django as tied to the active record pattern as is Rails? And yes, I know you can swap out persistence layers in modern Rails, which is good (because active record is utter bilge), but who does that?

&c.

No, it's not. But since Rails 3 neither is rails really. Rails is more about the ActiveModel pattern, which has it's own API. Active Record inherits from ActiveModel. You can pick and choose what you want in your persistence classes, or even better, make models/classes that have no persistence layer tie.

For instance, if you want to use a class like it was a MySQL table, you could include a few ActiveModel classes which will make things for ActiveSupport helpers work with them.

http://api.rubyonrails.org/classes/ActiveModel.html - pick and choose what you want in your classes. This was one of the major changes in Rails 3

EDIT: just to clear it up, by ActiveModel I mean Model. Rails is convention over configuration and adheres to the MVC pattern and philosophy

Maybe I misunderstood your question. If you're looking for reasons to pick one over another, then it's whichever language you know best.

Web frameworks really only differ in philosophy, and in this case, both are batteries-included, monolithic frameworks. They are practically identical solutions.

Philosophically they're quite different. Every layer follows a different approach: templates, controllers (views in Django), urls, model definition, ORM etc. A lot of this comes from the core philosophies of the languages, whilst Ruby and Python may be closer to each other in philosophy than either are to say Java, they still have substantial differences.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.