News for hackers. Stuff that matters.

Rails vs. Django

Just curious, and I want to see which framework I should pursue more aggressively.

So, how about pros/cons of each.

( 34 comments | 18 points | on HN )
Re:Rails vs. Django by SwellJoe on Friday August 31, 2007 @05:06AM (#48655)
Deployment of Rails sucks.

Django is far better thought out, and can be deployed in a very sane manner. A fleet of Mongrels is just an embarrassingly bad way to handle concurrency. "I know, let's write a crappy barely functional web server, spawn a metric ass ton of them, and then balance between them with a proxy. It'll be most leet and super fast! We'll call it a Best Practice. It'll be awesome." In fact, it's fragile, doesn't scale very well, and is complicated to configure. It's also a huge distraction from solving the problem in a sane way--people seem to think "deploying Rails" is solved by this and Capistrano, when really, it's just a new stack of problems.

Otherwise Rails kicks ass, and I like Ruby better than Python (but I'm a perl monger, so I might be brain-damaged into not seeing the beauty of Python). But I do tend to feel like Django is being written by grownups who've got years of development experience, while the Rails folks are making it up as they go along...sometimes going down really poorly chosen paths (I believe Mongrel is an example of this, but I'm no expert).

Then again, I think if I were starting an app from scratch I'd pick Catalyst. But I haven't spent enough time with any of them to know which one is really most productive for the way I work. I think you'll want to try them out, and not take advice from random dudes at news.yc.

Re:Rails vs. Django by davidw on Friday August 31, 2007 @06:19AM (#48670)
I went for rails myself, and agree about Mongrel. It seems like the Rails guys are all anxious to throw the Apache baby out with the bathwater, and spend a lot of time fooling around with dodgy ways of doing things.

For now, I use the mod_fcgid Apache module, and it seems to work ok for what I need.

Re:Rails vs. Django by altay on Saturday September 01, 2007 @04:59AM (#49186)
i heard through the grapevine that zed shaw, the dude who wrote mongrel, is down on it and isn't actively developing it anymore. hopefully someone else will pick up the slack, but i'm afraid that 95% of the folks using ruby+rails are know-nothing newbies (like me). =P

anyone have any experience with lighttpd + rails?

Re:Rails vs. Django by lojic on Monday September 10, 2007 @10:49PM (#53131)
Oh really? Why don't you either stop spreading FUD, or back up that statement with some reality. "heard through the grapevine" - give me a break.
Re:Rails vs. Django by lojic on Monday February 18, 2008 @09:43PM (#118620)
Wow, in light of recent Zed events, I think I owe you an apology! That must be one heck of a grapevine.
Re:Rails vs. Django by jey on Friday August 31, 2007 @06:20PM (#49004)
I'm not sure why they think "assload of processes + proxy" is so good either, but deploying an assload of mongrels behind the "pound" load balancer is damn easy. Plus, pound is light-weight, fast, and designed to be small so that it can be easily security audited.

All you have to do is install pound, edit the pound config file to tell it how many mongrels you have and what port range they live at (easy), do a "gem install mongrel_cluster", then a "mongrel_rails cluster::configure" and a "mongrel_rails cluster::start".

I know this sounds like a lot of steps, but if you've ever built and configured apache from source you know this is cake in comparison.

Re:Rails vs. Django by SwellJoe on Friday August 31, 2007 @07:29PM (#49041)
Ah, yes, I'll wait here while you go convince a few shared hosting providers to let you do that to their servers.
Re:Rails vs. Django by jey on Saturday September 01, 2007 @10:36AM (#49215)
Touche.
Re:Rails vs. Django by menloparkbum on Friday August 31, 2007 @02:56PM (#48866)
what is the preferred way to deploy django these days?
Re:Rails vs. Django by brett on Friday August 31, 2007 @03:16PM (#48880)
Re:Rails vs. Django by hsiung on Friday August 31, 2007 @04:44AM (#48649)
jesusphreak has a pretty good writeup that's worth reading on the pros of using django: http://jesusphreak.infogami.com/blog/why_django

Having come from a rails background and later switching to django I think it comes down to a matter of preference. Django's ORM gets the job done but leaves something to be desired (ugly syntax, no multiple database support, also watch out for implicit cascading deletes!). Conversion to using SQLAlchemy was supposed to address the gaps, but the branch for the upgrade seems pretty dead... But overall I'm pretty happy due to the transparency of django's framework code. I've implemented some customizations that would have been a lot harder to pull off in rails.

If you had to choose a python web framework, I'd suggest taking a look at pylons which is more flexible (also, by default it uses mako templating which > django's templating and supports SQLAlchemy).

Re:Rails vs. Django by kashif on Friday August 31, 2007 @11:51AM (#48749)
Actually SQL sucks and hence all wrappers suck too. The over-engineered SQLAlchemy sucks most. If you are python user you should find SQLAlchemy ugly.

As far as frameworks goes, for most deployments(not for all) I would suggest pylons over django.

Mako is very useful.

Re:Rails vs. Django by jey on Friday August 31, 2007 @06:21PM (#49005)
"Actually SQL sucks and hence all wrappers suck too. "

Amen.

Re:Rails vs. Django by dood on Friday August 31, 2007 @02:06PM (#48825)
I'm curious what you dislike about SQLAlchemy, the ORM, the SQL toolkit, or both?
Re:Rails vs. Django by kashif on Friday August 31, 2007 @02:34PM (#48846)
Both, but the ORM more. I am curious, why do you ask?
Re:Rails vs. Django by dood on Friday August 31, 2007 @02:51PM (#48862)
I've been learning it recently and I'm not sure what to make of it, specifically the ORM component. It certainly has a good reputation as far as ORM's go, but I'm not sure if even a good ORM fits a large, popular, or complex app, or is perhaps more suitable for protoyping and low-traffic uses.

But since SQL is pretty necessary for most web apps, it makes sense to pick some abstraction layer, and as far as I can tell SQLA is best of breed for scripting languages, so I'm trying to work out how to apply it most effectively.

Re:Rails vs. Django by kashif on Friday August 31, 2007 @04:34PM (#48949)
Oh yeah...One more thing. The good reputation of SQLAlchemy - is unfounded. Let me explain.

See it does all the basic stuff and so do the others.

Then some relatively famous programmer who is also a blogger wants to do something esoteric so they evaluate all wrappers and eventually find that SQLAlchemy can do it if you are willing to write brain damaging code.

Then because after many many hours of head banging they finally make it work they can't wait to gloat over the sustained brain damage and how SQL Alchemy rocks, so they write it up in a blog.

Then guess what, simpletons like me read the famous peoples blogs, get suitably impressed and sustain permanent brain damage, if we survive we join the bandwagon and gloat too - with good reason, this thing is impossible for humans to use. If we fail, we do what we should have done in the first place, look for alternatives.

PS: Now that I read it again it sounds like I am talking about Ruby on Rails!!

Re:Rails vs. Django by kashif on Friday August 31, 2007 @04:24PM (#48941)
Things I learnt, that might help.

1. You don't have to use SQL.

2. If you are going to use SQL, Find a wrapper that is minimalistic for your current needs. Work with lesser and you will work more but you will also work with more freedom and sanity.

Best of luck friend. :)

Re:Rails vs. Django by dood on Saturday September 01, 2007 @01:06PM (#49240)
Thanks for your thought-provoking comments, actually I had quite forgotten that I didn't necessarily need SQL (despite reading all the threads about that here)!

Trouble is, I understand the theory of in-memory data logged to disk, but as I'm just a humble hacker (self-taught amateur) there seem a lot of unknowns in such an approach. SQL, though a pain, is at least familiar and abundantly documented.

Guess I'll do a little more research, and a little more hacking, since I would be quite happy to drop SQL entirely!

Re:Rails vs. Django by kashif on Saturday September 01, 2007 @06:32PM (#49298)
Actually, I am self taught too and most hackers here are probably much better than me. I use python, if you do the same then try out Zope DB and schevo.org. These are Object based DBMS - non SQL. The problem like someone pointed out is that such systems are not language agnostic.
Re:Rails vs. Django by gscott on Friday August 31, 2007 @04:34PM (#48948)
I know nothing about sql wrappers but I do know whenever I have a scaling problem it is ALWAYS the sql. I doubt if any wrapper will save me from this. As your database grows larger you need to fine tune your sql, indexes, and so on.
Re:Rails vs. Django by JMiao on Friday August 31, 2007 @05:26AM (#48659)
agreed.
Re:Rails vs. Django by dood on Friday August 31, 2007 @06:23AM (#48674)
Pylons is deserving of attention. There is a small comparison of Django and Pylons here [http://wiki.pylonshq.com/display/pylonscookbook/Concepts+of+...].

I'm playing around with Pylons and have been impressed so far. The whole approach strikes me as more of a hackers framework; less magic, more flexible, extensible. Though the docs need a little work, and the community isn't as big as Django yet, Pylons seems to be blossoming into quite an excellent framework.

Re:Rails vs. Django by kashif on Friday August 31, 2007 @11:47AM (#48746)
You are on the money dude, I have been using pylons for a while and it is much more usable than Django.
Re:Rails vs. Django by JMiao on Friday August 31, 2007 @05:04AM (#48654)
What type of app are you looking to build? The scope of the project would carry weight here.
Re:Rails vs. Django by andyn on Friday August 31, 2007 @05:39AM (#48663)
That and whether you're more comfortable using Python or Ruby.
Re:Rails vs. Django by nanijoe on Friday August 31, 2007 @06:00PM (#48998)
A search on amazon.com for 'ruby on rails' yielded 48 books, a search for Django comes up wuth 3 unpublished books.

The stats above, made the decision for me.

Re:Rails vs. Django by hello_moto on Friday August 31, 2007 @01:11PM (#48788)
kyro, why don't you do this instead:

1) Pick a very easy tutorial for both of them 2) Do them 3) Choose

Framework will only get better each day so if today Rails deployment sucks, tomorrow it'll become better unless the growth is stagnant. Same case with Pylons or Django or the 100000000000000001 python frameworks out there.

Now if you're looking for a job, Rails would be a better choice because the hype marketing has converted a lot of people (they drink the kool-aid straight from the hose).

Re:Rails vs. Django by dood on Friday August 31, 2007 @02:02PM (#48818)
I don't think this is a good way to evaluate a framework; tutorials don't necessarily bear much relation to the reality of using the tool.
Re:Rails vs. Django by cnu on Friday August 31, 2007 @02:53PM (#48863)
Agreed. Most of the frameworks have the 20 minute tutorial which (most of the time) is no way comparable to the type of work we will be doing with it.
Re:Rails vs. Django by hello_moto on Saturday September 01, 2007 @05:45PM (#49283)
That's right.. in a way.

You need to love the platform you're going to develop on top of. Guys like him, that ask which one is better, needs to at least give both of them a try and see which one he likes it the most.

Just like the most common comments from the Rails vs Django: it's up to which one you're comfortable/love.

I tried Rails, Django, TurboGears and I ended up with ASP.NET.

Re:Rails vs. Django by kashif on Friday August 31, 2007 @11:48AM (#48747)
What are you designing? One might be better suited.
Re:Rails vs. Django by yrashk on Friday August 31, 2007 @09:40AM (#48700)
Rails looks to be more DRY than Django. Though I'm on Rails and don't really use Django.
Re:Rails vs. Django by rms on Friday August 31, 2007 @05:47AM (#48664)
What about Pylons?