3 ms·
I've used both professionally on large and small projects. Both work fine, but the have a pretty big philosophical difference. Rails emphasizes writing as litt
by ageitgey 8y ago
I've used both professionally on large and small projects. Both work fine, but the have a pretty big philosophical difference.
Rails emphasizes writing as little code as possible by having a lot of "magic" that you are supposed to know about by convention. For example, almost every object is available globally with no require statements. Also, model objects automatically have methods on them for every column present in the matching database table - you don't list out the model fields in code. There is also a code scaffolding system that generates what little boiler plate code is needed to add new pages.
Django takes a more explicit approach. You have to import controllers or helpers you are using. Models have actual code that define the schema. There is no codd generator system.
In general, I think Rails is faster to get something running from zero. You can build a functional site in like 30 minutes. They really nail single developer productivity.
On the other hand, Rails sites tend to turn into a big ball of unmaintainable memory-sucking spaghetti if you have a big team working on them. There's just too much "magic" and hidden interactions going on.
Django gives you the tools to avoid that, but it also prescribes less about the "right" way to do things so there is still plenty of opportunity for your app to get bloated or terrible if you do it wrong.
IMO, Rails is much "nicer" in terms of quick productivity and sanded down edges and working solutions out of the box. Just look at how much easier basic stuff like compressing css/js is in Rails than Django. Django is more an assemblage of disparate parts that work together, more or less.
But while both work fine, I'd choose Django because Python is a much more popular language to find a team for and I much prefer explicit over magic in the long run. But that's just me.
tl;dr - Rails is the artsy kid and Django is the engineer.