This post is from the early days of Stack Overflow, and while we recognize its historical significance, we also recognize that the current community of users will likely close similar posts. Please feel free to read and learn from this post, but refrain from creating similar posts just because this one exists.
I'm interested in learning a web framework. The two big ones, as I gather, are Rails and Django. Which one is better and/or faster? Is one better designed or more logically consistent than the other? Is there another framework I should look into? How easy is it to set up and administer a Rails or Django server, and how easy is it to find a shared hosting plan?
To give a little background, the websites I'm currently used to making are in straight PHP (no framework) and I'd like to be able to manage some of the complexity that comes from feature creep. Outputting HTML with echo becomes a lot less fun the more you have to customize it. In addition, I don't know either Ruby or Python so I'm free to go either way.
note: I'm not interested in ASP. I'd like to develop on a Mac and deploy to Linux/FreeBSD and I don't think that ASP fits the bill.
To everyone that's replied so far: thank you! Choosing a web framework can be a difficult thing, so I'll try to narrow down what I would like to do.
First, I would like to build small, custom sites (hard to call them "apps") that serve data from a database, and optionally an administrative interface to manage everything behind the scenes. As an example, I have a website for my grandmother to showcase her artwork built in PHP. I've spent more time on the backend than the front end to enable her to reorder, relabel, and reprice her artwork as well as upload an image, tag it, and have it scaled and appear on her site.
I notice both frameworks generate "scaffolding" that can be used as a rudimentary admin interface; how would they handle non-textual data (like images)?
Also, when watching a Rails screencast, there was a casual mention that the framework does some singular/plural translation. This strikes me as quite odd - is this what is referred to as "magic" in Rails? If so, does Django (or any other framework) have a more sensible naming strategy?
From my experiences, rails seemed to be more of a black box than django. You issue some command and some stuff happened and you got a basic CRUD application. You run this particular function and something happened and you got something else as an output, not knowing what the middle bits were. While this is fine for easy things, the lack of online documentation (in my experience) was a huge hindrance.
Django, on the other hand, seems to be more logical and transparent about what's going on behind the scenes. There's no "magic". Django is also one of the best documented open source projects out there.
Just came back and saw your additions:
If you want something with an extensible admin, pick Django. This is a test in which Django shines. Its clean looking and is extensible. In my experience, the Rails scaffolding is typically thrown away as you add more functionality. Its meant to get you up and going, but not necessarily something you'll see in production. That being said, lists for grandma aren't exactly production :) Reordering field and such is fairly easy, especially given the many community contributions to the admin.
When people talk about "magic" in Rails (or any other framework for that matter), they're really talking about things happening without it being immediately obvious why or how. A key example of this is Rails' find_by_* function. Its autocompleted function that you don't explicitly define, but its just "magically" there. You can find a lot more information at http://www.stephenbartholomew.co.uk/2007/6/4/is-rails-magic Purely antecdotal, but I've found that Python (and Django) itself is much more explicit where as Ruby (and Rails) rely a lot more on convention ("That's just the way its done.")
The eternal question.
The answer: try both and see which one fits best for you.
One of the main reasons I jumped from RoR to Django was the documentation.
The community and the admin interface are both wonderful, but the documentation is what sold me.
If you are learning, documentation is really important. You don't want to google to find blogposts which talk about this feature in an earlier release, and broken now! http://42topics.com/blog/2008/06/an-interview-with-adrian-holovaty/#comment-381
I have read somewhere : If you know Python then use Django, If you know Ruby then Rails
Both Ruby and Rails have more 'magic' involved. This makes development very fast when you understand the magic, but frustrating when you don't. The documentation is also scattered; some of the newer features of Rails are only mentioned in blogs, or passed along by word of mouth.
Django is extremely well documented, and Python is likewise a 'no-tricks' programming language. It's not quite as 'fun' as Ruby, but it sounds like it would probably suit your need better.
I think it depends if you like to code in Python (Django) or in Ruby (Rails). The Frameworks are both very well designed and working well. I would prefer Rails because i like ruby :)
My take on it is that Rails is more popular, more trendy, more volatile, more complicated and more versatile.
Django, on the other hand is more organized, better documented and comes with authentication and administration built in.
So if you want a fast evolving slightly crazy and egotistical community and framework go for rails. If you want slow and sane go with Django. I choose the slightly crazy.
One word : Cucumber.
I prefer Rails because it has more test tools. You can use tons of very inspiring test tools. I can barely think about using rails without Rspec, factory girl among other tools, and the new cucumber gem is just incredible.
I'd like to develop on a Mac
Then Rails may be a better fit. Apple seems committed to having a good out of the box Ruby/Rails development experience. (Pre-installed ruby and rails gems + other dependencies)
Although, to be honest the Python/Django experience is just as good, just maybe not baked in and fully supported by Apple.
Its a little dated now, but this comparison of both  has some good info on both. Try them both out and see which suits your needs. http://docs.google.com/View?docid=dcn8282p_1hg4sr9
Two cents from a Django user who has never used rails:
Django is most intuitive when you are writing custom public views and accepting the admin interface more or less as is. There is a lot of customization that you can do without much trouble, whether it's customizing style, specifying which fields will be editable, or specifying what type of html form elements should be used by selecting a widget. But if you have to make particularly powerful edits to the admin site, this will probably require the most detailed understanding of python syntax and idioms. Your first few python tutorials will likely skip all the details of new-style objects, decorators, Meta classes, and other syntax introduced in releases of python 2.x.
I'll say the same holds for more complicated SQL queries. (My guess is that every ORM framework is going to require more detailed knowledge for more intricate SQL queries.)
The good news? Even though Django itself is heavily powered by the newer python features, a few introductory python tutorials will be fine to let you do most of what you need to do in Django. And, once you read the four page Django tutorial, you'll feel like you can 50% build your site.
Oh, and as for non-textual data, I haven't actually used this, but I believe it is supported by default in the ORM. This probably won't mean too much to you right now, but others can comment on it:
Anyway, as far as I know, everything supported in the ORM has a default admin interface, so it should be doable out-of-the-box.
Ultimately it depends on what language you'd rather work in. If you are comfortable with PHP already, then you may want to look at http://codeigniter.com/ which is a framework similar to Rails, Django, Pylons, Spring etc, but in PHP which you are already familiar with.
The other factor to consider is the server. With passenger (mod__rails) shared hosting now has a much better way to offer Rails hosting. mod_python should help you with Pylons or Django (python based frameworks)
How much customization are you looking to do? Would a content management system like Joomla or Drupal work for you?
Rails and Django are really easy to work with on your local computer since they have test servers that can be run right from scripts in their installation.
Better is a subjective term, and faster depends on what you are doing with it. If you don't want to learn another language, go with code igniter. If you want to learn ruby or python, then play around with both rails and pylons or django, and then look at what your hosting options are.
I don't know much about SQLAlchemy but it is supposedly a great ORM package that is only an option when using python. So if you need a very flexible ORM, then maybe python is the way to go.
I've tried both Rails and Django.
Personally, I prefer python syntax over ruby, but I think Rails is one step over Django.
I like how rails plugin system let you build a complete webapp in a few hours and especially I like the way rails and ruby support TDD and BDD.
From the other side, Django has a great pluggable app system and this is probably the most "to have" feature on rails.
Rails has a very good plugin called paperclip  which allows you to attach images to records in your database. It stores them on the filesystem and a link to that file in the database. Paperclip will automatically scale your images as you upload them as well into any number of sizes you wish.
Scaffolding in Rails is generally only good for text-based interfaces. Once you get into file uploading, you'll want to look at a good tutorial (or the paperclip documentation) about that.
The singular/plural translation is when you have a table called "forums", the model that corresponds with this is called "Forum". This is so when you do something like
Forum.find(:first) you're effectively telling rails to "find me the first forum" not "find me the first forum**s**". Tables and Controllers are always plural, models are always singular. You'll learn all about this in any good Rails tutorial or book (e.g.
Agile Web Development with Rails 3rd Edition
If so, does Django (or any other framework) have a more sensible naming strategy?
What's not sensible about that? http://www.thoughtbot.com/projects/paperclip
For everyone that says about magic in ruby or rails: http://gilesbowkett.blogspot.com/2009/07/do-you-believe-in-magic.html
Besides the obvious issues(whether you like python or ruby) you may want to look into the deployment issues with both frameworks. If you choose Django, you'll be able to use Google Apps. If you choose Rails, there's no Google Apps. But there're many other good options such as Amazon EC2/S3. Deployment used to be a hairy issue with Rails, but with mod_rails, I guess its no longer an issue.
Another issue could be the local community. If there's a vibrant community of Python coders in your city, it'd be better to join them. It always feels better to have other geeks around who can help you.
There was a good article posted back in January (so it might be a bit out of date now, knowing the speed these frameworks move at) in Smashing Magazine:
It may help in your research. http://www.smashingmagazine.com/2008/01/04/frameworks-round-up-when-to-use-how-to-choose/
I enjoy rails. However, as some have said, Rails moves quickly. They seem to adopt and then drop 'standards' very often. Google searches return outdated and broken ways of doing things as the top or near top hit.
That all said, rails is very powerful and if you can get up to speed it works wonderfully.
For the most part, I agree with others here. However, I'm fairly familiar with rails, and pretty familiar with django. I've found that knowing python gets you a lot farther with django than knowing ruby gets you with rails. That said, they are both very powerful, and will likely be able to do anything you would want.
I've written a blog entry about Rails vs Django  that replies to your question.
Since you will just need to display (or insert or something) data and have an admin interface, I'd go for Django since it gives you that out of the box. On everything else, I'd say it's a tie, but the post explains it in detail. http://wiki.alcidesfonseca.com/rails-vs-django
You may want to take a day or two and try out CakePHP —not as an end in itself, but as an introduction to the concepts behind Rails. Last time I checked, Cake was the closest to a port of Rails of any framework. If you like it, you're more likely to enjoy Rails (and conversely, if not, not) http://cakephp.org/
They're both excellent, but very different. Personally, I prefer Python, but find Django overly difficult, especially for mere mortals. There's not really any significant alternative to Django.
On the other hand, if you like Ruby and the rapidly growing toolsets around it, but don't like Rails itself all that well, it's worth looking at Merb, too (merbivore.com). I'm having a Ruby on Merb project written for me right now by contractors, and I can tell you I'm flat amazed at the productivity they're getting in this environment - and I'm not all that easily impressed...
I'm a PHP developer as well and I really like Django; I have no experience with Ruby on Rails though;
You can also use a PHP Framework offcourse, a good candidate is Symfony  http://www.symfony-project.org
Since you're using PHP, I'd recommend CodeIgniter . It's well-documented and has a nice set of functionality without being too complex or bloated. I'm using it all the time!
Edit: I haven't used CodeIgniter since 2009. Kohana is a neater alternative, but if you're really serious about your apps, I'd suggest looking into Symfony  (what I'm using at work as of 2011). Symfony is much harder to learn -- and cheat sheets are mandatory -- but it's much easier to create "enterprise" applications. http://codeigniter.com/
An alternative to Rails that is less restrictive of your design decisions is Ruby framework called Merb . http://merbivore.com/
I would strongly encourage you to try the first chapter or two of several intro books and make your decision based on which is the easiest for you to learn. They are both good frameworks, so you can't really go wrong. If you know one of the two languages already (python / ruby) then use the language you know.
Things that tipped me in favor of rails:
Beginning Rails 3 . This book is a phenomenal beginners guide to MVC frameworks and Rails. I went from zero to useable programming in one weekend thanks almost entirely to this book.
Railscasts . Good screencasts are hard to come by, and Ryan Bates has created the holy grail of screencast sites dedicated to Rails and all for free. This is a HUGE help in learning a new system.
Heroku . Heroku offers awesome cloud hosting for ruby applications, including rails. Killer features: it's free for small sites, and it works entirely on a GIT workflow.
I would really encourage you to check these resources out. If you can find similar stuff for python and feel like learning Django will be easier and more productive for you, then by all means go that way. For me, the amazing community resources and ease-of-learning made Rails the right choice. http://rads.stackoverflow.com/amzn/click/1430224339
Few years ago, I tried both, plus Symfony. Symfony was not mature in documentation, and didn't appeal to my taste. A friend who chose Symfony back then is now working to migrate to Rails.
Django was better than Symfony, but at least back then, the documentation wasn't so rich, their admin interface is definitely better than the default Rails scaffold, but their migration was messy and required manual work more than Rails does. Also, Django seemed optimized for news publishing or perhaps blogging. It can set you up quickly with no effort. Rails seemed to me more general.
The community seemed stronger at the time. I'm not following up on Django these days, but Rails is becoming more and more popular with larger crowd.
Also, the huge gem (extension) collection makes it time saving to go Rails. There is also the latest Rails Admin gem, which pretty much seems to fill the missing piece, matching what Django have to offer. Yes it's not by default, but it's few lines of code.
So for me, I tried the three few years back, went with Rails, no regret nor any thought of changing.
There are significant philosophical differences between the underling programming languages, Ruby (Rails) and Python (Django). Because of these, most people love one and hate the other, so your best bet might be simply to try both and stick to the one that clicks first.
The frameworks, Rails and Django, offer roughly the same level of sophistication, so don't worry, you're not going to make a "wrong" choice no matter how you decide.
(For the record, I'm a Rails dude.)
I know for a fact there is a great community behind Ruby on Rails ( mailing list, irc channel , and at least two  forums ) and probably an equally greater one behind Django. I agree with Hyposaurus, try both and work out for yourself which one you like.
A Rails server is easy enough to set up, it's just a matter of installing Ruby (which comes with Mac OS X), Rubygems, Rails and optionally the gem called Mongrel, which is a HTTP web server.
Deploying a Rails application is easy enough, with Capistrano or Vlad the Deployer to help you out there and there's plenty of documentation for both programs to help you along the way. Setting up on servers is now easy thanks to Phusion Passenger  which has epic documentation also.
I personally prefer coding in Ruby because the language is written to be read by humans primarily, not machines.
Best of luck. http://groups.google.com/group/rubyonrails-talk
A lot of PHP developers migrated to Rails successfully (have a look at Rails for PHP Developers ). http://www.pragprog.com/titles/ndphpr/rails-for-php-developers
As mentioned, they're both quite similar. I would suggest finding more about the community for each framework to help you decide.
Is the documentation good? Are great books available? If you post to a forum, are others helpful or condescending?
From my experience, the community and availability of good resources makes all the difference.
My personal preference is Ruby on Rails, but my reason for choosing it over Python and Django was strictly personal. I've heard nothing but nice things about both Rails and Django.
My perspective -
"Don't try to reinvent the wheel."
Was in your boat about 6 months back. could've gone either ways language/framework wise. Did some research & found google promoting python/dJango big time.
I love clean looking code and also love the speed of development which python gave.
As an engineer you would want to try your hands on both and then pick one, but hey, how much time does that take?
I decided dJango/python since I guess a lot of smart(er) people have spent time at google on this. 8-)
Sticking with it till I hit a wall. Maybe Rails will break the wall at that time 8-)
This should help you in deciding:
Watch out for the other comparisons too... :D
You may want to consider if you'll ever want/need to run on the JVM and see what options are available for either framework.
It's actually not about learning a particular framework - both is equally good (or bad depending on your point of view). If you have time, do both, and if you dont have time, pick one whose language you are unfamiliar with (so that you learn a new language..hit two birds with one stone as they say).
@ Hyposaurus 
That is always an option. However, there are aspects I'm curious about that I wouldn't be able to determine for myself without extensive testing, such as scalability. I'm hoping that there are some people here that have tried both and have some observations they can share.
@ DubCee 
Why do you prefer coding in Ruby? Do you prefer the syntax, or are there more powerful features that make writing web apps easier or more fun? #91861
Django is kind of a mess. Rails is the easy answers, hands down. I picked it up in a weekend.