Topic: Rails vs Django

I apologize if this has been posted already (did a search and didn't find it), but I really am curious about the strengths and weaknesses of each framework. They seem to have similar philosophies, and I would love to use both. Here was a reply by one person to my question "What does Django offer "for free" that Rails doesn't?":

- Production-ready admin interface.  It uses reflection rather than generated code.  That way when you update your models/tables, all the admin forms show the new fields and stuff.

- Extensible authentication framework
(http://www.djangoproject.com/documentat … ntication/)

- Internationalization (http://www.djangoproject.com/documentation/i18n/)

- Extremely flexible URL design.  This has been crucial for us designing a RESTful API, and makes it a snap to change how your app is arranged.

- Built in Syndication framework (http://www.djangoproject.com/documentation/syndication/)

- Sitemaps framework (http://www.djangoproject.com/documentation/sitemaps/)

- Cache framework (http://www.djangoproject.com/documentation/cache/)

- Automatic generation of forms (http://www.djangoproject.com/documentation/newforms/)

- In Django, a "view" is equivalent to a "controller" in rails.  Many times these views are repetitive (list objects, edit objects, archive by date, pagination, etc).  Django has something called "generic views" which allows you to get all this functionality for free, just
by configuring your URLs properly. (http://www.djangoproject.com/documentat … ric_views/)

There's a ton of other stuff out there, like the Comments app, ContentTypes, all kinds of cool stuff.  After using both Rails and Django, I see no reason to use Rails anymore.  On top of the
frameworks themselves, Python as a language is much more mature and proven.  Deploying django apps is a breeze.  Rails, well, not so much (at least in my experience).

Not trying to start a religious war between the two frameworks, but I would really like to know if there is anything to it. Always the right tool for the job and I would like to know what jobs Django is good for.

Re: Rails vs Django

That's a helpful list. I have never tried Django so I hesitate to comment too much on this subject.

One thing I've heard is Django is more focused on content where Rails is more focused on application functionality and user interaction. This makes sense if you compare the two sites the frameworks were extracted from. I have also heard the two frameworks are similar enough where you can't go wrong with either one. There are certainly good and bad points to both of them.

Looking at the list though, I haven't longed for anything mentioned. I am fully satisfied with Rails which is the only reason I haven't tried Django. If the items mentioned appeals to you, I encourage you to try both frameworks. I believe it is largely a personal preference.

Just a word of caution: there are very few people out there who know both frameworks equally well. The items mentioned in the previous list were probably something I would be interested in when starting out with Rails, but the more I grow with it the more I understand why these things were left out or done differently.

Railscasts - Free Ruby on Rails Screencasts

Re: Rails vs Django

Great comments Ryan. I was actually curious about whether or not there would be people who are experts at both. They are both relatively new frameworks that use modern languages, but from what you are saying there isn't exactly a mass exodus from RoR to Django or vice versa due to the features. When compared to PHP vs. Rails both frameworks are holding their own it seems.

I wonder if it is more important to pick a framework and stick with it rather then just switching to get a these features. With PHP and Rails, the reasons to switch over are obvious and glaring. With Rails and Django it seems not so much.

Re: Rails vs Django

I think it's good to stretch your knowledge of other frameworks and languages. As mentioned in the Pragmatic Programmer book, try to learn a new language every year. I will probably pick something other than Python this year (I've always wanted to learn Smalltalk, maybe I'll try to tackle that).

As for jumping between the two frameworks, I personally can't stand maintaining multiple sites from different frameworks. Having to constantly switch gears and wishing certain things were in the other language/framework. Rails & Django are similar enough feature-wise (AFAIK) that you won't get much benefit choosing the one that fits the job better.

Railscasts - Free Ruby on Rails Screencasts

Re: Rails vs Django

Just to finish this topic off. Two glaring differences between the two frameworks:

- Django doesn't have migrations or anything like it
- Django doesn't have RJS

A more direct comparison between the two frameworks:

http://www.infoq.com/news/2006/11/rails … ad-to-head

Re: Rails vs Django

Each Django and Rails have their own strengths, overall Django is fastest in my observation.

Re: Rails vs Django

They really are comparable.  Django is definitely faster at the moment but Jruby is making good progress and the next couple of years will see enhancements in the ruby interpreter.

Django's strengths (as I see them):
- focus on content, easy pulishing
- easy combination of multiple 'apps' (Imagine if you could embed Rails apps together)

Rails' strengths:
- RJS and the whole REST stuff
- ActiveRecord
- TextMate
and the one that clinches is for me:
- a massive inertia driving it's adoption

I do hope to learn Django sometime soon.  I'm impressed with it and I appreciate the maturity of the Python language.  It must be nice to already have a library for everything written in your language of choice.

Re: Rails vs Django

Personally I hemmed and hawed over these two frameworks for months before settling on Rails. I really wish I would have decided sooner, but I wanted to try both for myself. My impressions:

Both are capable frameworks but you can definitely feel the roots of each one. Django was born into the publishing world while Rails was born in the world of slick web applications.

Of course your decision should also be based on which language you prefer.. Python or Ruby.

People talk all the time about how mature Python is and how many great libraries are available. But what does that really mean for web developers?

In my exhaustive research I found that Python is used more for general-purpose programming and much of this maturity is not based on the web at all. In all my googling I could not find a Python module for shipping or even one book on e-commerce.

By contrast, there are a wealth of Rails tutorials, books and screencasts out there for the aspiring programmer, not to mention heaps of great plugins for the type of work I am doing. Why reinvent the wheel?

Though it's purely subjective, I also went with Ruby because I find the code MUCH more attractive to look at. It reads like plain english and fits my head better than Python ever did.

Another factor which influenced my decision was simply looking at the types of folks who are attracted to Django vs Rails.  Take a gander at sites made with Django, then compare them to the sites made with Rails. I see a lot more creativity and fun on the Rails side by far.

Of course no framework is going to be perfect and Rails could learn a lot from Django (and vice versa)

Django Strengths

- Loose coupling of applications within projects (sorry Rails, engines dont cut it)
- Admin application that is envied by even DHH
- Terse template language which forces you to keep your views clean (designer-friendly)
- Super fast development time with fewer lines of code
- Django docs are pretty damn cool
- Ideal for content management (blog, news, etc)

Rails Strengths

- Migrations (i dont know how I ever lived without them)
- Test Driven Development
- More documentation (books, blogs, screencasts)
- AJAX & JS integration
- RESTful development
- Rapidly growing community / widespread adoption
- Ideal for web applications and e-commerce

If you are sitting on the fence like I was for so long, my best advice is to *gasp* actually try building something with either framework rather than research which one is better. It really is a waste of time because you wont know which one will meet your needs till you try them out for yourself.

Good luck!

Last edited by pimpmaster (2007-03-02 08:31:52)

Re: Rails vs Django

Thanks pimpmaster! That post is really useful and I agree with everything you said.

Railscasts - Free Ruby on Rails Screencasts

Re: Rails vs Django

You know what they say about great minds

wink

Re: Rails vs Django

Here's a detailed writeup
http://www.vaporbase.com/postings/Evalu … rt_1/15%29

Re: Rails vs Django

Just to add a bit more to this debate, I have been playing with django a bit lately as I find it a very intriguing framework. If there was one thing that makes me truly envious, its the modular nature of django.

You have projects and in those projects you have applications, basically chunks of functional code that can be reused inside different projects. It could be a forum, wiki, blog, whatever. This idea is very attractive if you find yourself having to implement a lot of the same functionality across several projects.

To my knowledge, the only way to achieve this in Rails is to either write a plugin (which will only get you halfway there) or build an engine (a huge PITA) Django's implementation of applications is a breeze in comparison.

I dont know what DHH and company have in store for 2.0, but I hope they are watching some of the competition and taking notes.

Re: Rails vs Django

I totally agree with you pimpmaster.  The new Rails Engines plugin has taken some great strides toward allowing Rails to do this but there's still much work do be done to go in that direction.

I find it hilarious that will all the talk of DRYness I still have to repeat the same pieces of controller and view code across applications.

Re: Rails vs Django

Not to get too off topic but has anyone found any comparisons between Symfony for PHP and Rails?  We're in the process here at work of trying to decide on a framework, we're a frameworkless PHP shop now.

Re: Rails vs Django

Ugh..

I wouldnt touch Symfony with a ten-foot pole.

http://wiki.rubyonrails.com/rails/pages … erformance

There are more performance tests I have seen out there, and Symfony comes in dead last every time. I have never used it but it seems quite bloated to me.

I have played with both CodeIgniter and the Zend Framework. CI is probably the fastest and most lightweight PHP framework out there. It really gets out of your way if you are already a PHP wizard. The docs are excellent and the community very helpful.

Zend has more impressive batch of libraries and its own IDE and has lots of Rails-like goodies baked in (testing, AJAX, JS support etc) The docs are still a work in progress but the community is also decent.

Both frameworks are opensource and backed by large profit-driven companies, a win-win combination.

Still, I found these to be pale imitations of Rails and all its Ruby goodness

Re: Rails vs Django

Symfony seems to have a LOT of up front configuration.  Plus it's trying to do a lot with PHP's whack OO. In my limited Rails experience I've been able to get so much more done with n lines of Ruby compared to the same number needed to do something in Symfony/PHP