A Django site.
December 6, 2006

Gabriel Puliatti
predius
comentarios peruanos
» Why Django kicks Ruby on Rails’ collective ass.

Django and Ruby on Rails seem to have surpassed all other frameworks like Turbogears or Symfony and are the talk of the web developing blogosphere, RoR going as far as making Ruby notable again, making it known to many people, as this language was almost unknown in 2004, before RoR’s opening. When I tried to do a quick web app I had to do, I skimmed over the two frameworks, finally deciding with Django to do my work on. As I moved on, I saw that Django, while not as hyped and AJAXy as Ruby on Rails, is much better and workable with than it’s main competitor. Ten Eight reasons why Django kicks Ruby on Rail’s ass.

1. Python.

Python drives Django, as many would know. Each time you write a line of code in a Django app, if it’s not on templates, you’re writing Python. This means that you’re able to use the large base of Python developers worldwide, and also the amazing number of Python libraries, coming from it’s 16 years of being heavily used, going into places such as Google, NASA and even some games such as EVE Online or the great Civilization IV. Furthermore, since Python has a more active userbase and more frameworks, if Adrian Holovaty, Jacob Kaplan-Moss and all of the Django developers suddenly dropped dead after I finish writing this, the porting of the code would be much easier than if Rails’ development stopped, where you would be stuck in the middle of nowhere if you ran into an issue. And who doesn’t want a language which has an implementation called IronPython?

2. Documentation

Django’s documentation kicks everyone’s ass. Not just Rails’. Django has a pretty documentation, easily understandable by both newbie and expert developers. Then, if by chance there’s something which can’t be found in the official documentation, there’s always a great ticketing system where many people posted code snippets and small howto’s, and awesome blogs such as B-List which help a troubled user to do everything from extending the user model, to being a master over generic views. However, Rails’ documentation seems confusing at first, with external tutorials and a massively confusing documentation repository.

Furthermore, the main Django developers decided to make an open book, which they have posted on the web and is open for comments, using a Django based publishing site they built, and some of Yahoo!’s Javascript libraries. The main problem with the many Rails books that there are is that they do not try to complement the Documentation, they are the documentation.

3. Templating.

Since Django’s inception, the templates have been designed so that there is no need to be a programmer to know how to create the templates. This means that the design can be split, making for skinnable sites and the ability to outsource the design to a designer, and not need that designer to pick up a book on Ruby on Rails’ in order to make the site pretty. Furthermore, since Django tries to keep as much coding away from the template as possible, the template’s are most often much more readable than the ASPish or even Cthulhuian .rhtml syntax that Rails’ programmers and designers have to use to design and display the processed information. Django’s system makes for much better cleanness using filters, which modify the way your text will be rendered, and template inheritance, making it easy to make dynamic websites.

4. Speed

Both Python and Ruby developers pride on the fact that both programming languages are fast. While they are slower than C and Java, they are probably the fastest in development times, allowing the developers to see the clear picture and work as fast as possible, avoiding as many errors on the way as they can. However, while both compete fairly in development times, the actual processing speed for a Python program is much faster than a Ruby program, while they are working on this. However, the same thing happens in the frameworks, which clearly show that Django is faster than both Rails’ and Symfony, a PHP framework. This means that your apps will be able to take a hammering better if they’re programmed using Django than if they’re using Ruby on Rails.

5. Free, JustWorksâ„¢ Admin interface

Django doesn’t need any MySQL managers, SQLite command line interfaces or any way to change records on the database, because it already has one. Every app is able to, by uncommenting two lines, have a full fledged admin interface containing all the modules that were written and have been marked for inclusion in it. Not only that, but the models may be modified so they appear differently in the admin panel, as it is fully customisable, making it easy to show some choices as drop down boxes or radio, or filtering by fields, etc. This is why none of the Django screencasts nor any of the tutorials need anything more than Django and a text editor, while you see all of the Rails’ screencasts, which there are lots, always having an open MySQL manager. Oh, and the admin interface in Django is damn hotâ„¢, too.

6. Generic views and feeds

With Django, there is no need to program when the operations being done are listing or editing objects, listing entries by date, or any of the basic CRUD operations, which means that the developer’s time can be spent doing useful things, not just getting simple things from the database, or directly editing fields. Furthermore, since Django was made in a publishing environment, creating RSS feeds is as easy as choosing what you want to pull out from the database and into the feed, and choosing where the feed will be retrieved from. This manages to take away the boredom in creating web apps, which in many cases involves cutting and pasting a lot of code, to create, edit or view, sort and manage items which are mostly alike. Django takes away all of this.

Django also has what they call the Flatpages, making it easier to create and select the URL of unchanging information, such as an about or contact page. Furthermore, it can also be edited, all using the Django admin, which makes it even easier than using HTML, not having to create a file nor edit urls.py to point the URL desired to the flatpage.

7. Better support and server

While both frameworks do not have much usage of big enterprisey databases, Django goes further than Rails on database support, as it supports MS SQL without having to do ugly hacks. Of course, its support for SQLite, MySQL and PostgreSQL is top-notch, with Postgres being used in all of Lawrence’s sites, which get millions of visitors each day. Furthermore, Django supports, thanks to the Python WSGI more webservers, as it gives more choice for the admin and more flexibility on setup. It does work on mod_python, which is a problem Rails has, as when it is used with mod_ruby, it has some security problems when running multiple sites on the same server, or just using FastCGI, which is not always optimal, especially due to configuration.. Further on, each Django process ends up being cheaper than having Ruby processes, meaning faster web apps.

8. Django is (mostly) buzzword free

Django isn’t plagued by buzzwords, as Rails is. Rails’ is to much that it’s own name, RoR has become a massive buzzword everywhere, even by people who will never program anything. Now that programming Rails is what the cool kids do, there is a lost value on a language, as the hype goes on and on. Especially having things like AJAX, Web 2.0, XML-RPC. Ruby on Rail’s ends up coercing developers into using too much AJAX, because “it’s way too easy”. The problem is that you get people trying to use AJAX where it doesn’t belong, and you get the complaints that the Web is going backwards in speed and loading times. However, Django is the balance. You can use RSS, if you want to. You can use AJAX, if you want to. You can even have sitemaps, if you want to.

If you want to be cool, and have loads of friends, snazzy AJAX for login scripts which end up failing when you forget to provide a fallback, or you can try the techie way, and bask in the tub of good code, simple design and choice, while not losing speed or reliability. Not at all.

EDIT: My apologies to Adrian Zolovaty Holovaty. It is Holovaty, as the developer himself says.

August 19, 2006

Gustavo Picón
tabo
Hacking for fun and profit
» Guido van Rossum and Django Redux

Some moths ago I wrote about the BDFL considering the use of the Django web framework.

Cronologically it went like this:

Please Teach me Web Frameworks for Python! (2006-01-27)

Literally a cry for help. He didn’t quite like the magic in Django, considering he used a pre magic-removal version.

Web Framework Redux (2006-01-30)

Perhaps WSGI represents the “blank slate” approach; Rails/Django represent the wizard approach; I’m still looking for the ideal mix-and-match solution.

Django vs. Cheetah: 1-0 (2006-01-31)

Guido is beginning to like the Django templates.

Which Part of “No XML” Don’t You Understand?

This one is related to his previous post. Guido just think that the use of XML in a template engine is WRONG. I couldn’t agree more.

Django Gaining Steam (2006-5-4)

Guido talks about Jacob’s Django talk in the Bay Area and Jeff Croft’s Django for non-programmers (a great article).

Months after that, Guido got interviewed in FLOSS weekly (2006-08-04) and he declared:

Leo La Porte (LL): Python doesn’t have a native GUI, there is TCL/tk… is that an issue?

Guido van Rossum (GvR): It seems to be coming less and less of an issue because more and more people are doing everything over the web

LL: The web is an interface, yeah

GvR: So of course that doesn’t really solves the problem because then you have, as I say, more web frameworks than keywords in the language. My personal favorite and I expect that will remain personal favorite for a long time is something named Django.

LL: I was going to ask you about Django. There was just a … just somebody published some article, interesting I think it was in the Rails website testing Django, Rails and a Perl framework and Django was by far the fastest.

GvR: Interesting! I didn’t hear about that.

Chris di Bona (CdB): How do you measure something like a web framework?

LL: Well they set a simple site and they used web testing applications to create lots of transactions and measure transactions and Django was like significally faster. So tell us about Django.

GvR: I am a very satisfied user of a very small part of Django. Django is sort of, I would call it probably a second generation web framework in Python where first generation would be things like Zope and Twisted. Django was originally started I think two guys who work for, believe it or not, a newspaper in Kansas. Not a very glorious location.

CdB: Well, it’s funny because Zope and Plone came out of the (??) newspaper.

LL: Well you know why, they have to streamline production workflows, that’s a big deal for a newspaper

GvR: Maybe that’s the case. This paper in Kansas decided that they wanted to set a local website with information for people in their town that was very responsive to the audience. They wanted to publish things very quickly but also not just add new articles to the site which everybody can do, but change the site completly, add new ideas, new features to the site, add new applications. They came up with endless number of examples, for example publish the sports, like the local sports results of the little league complete with hyperlinks to the teams and photos and all sort of interesting stuff. And they wanted to be able to roll that out very quickly and so I think they did that for maybe two years, and the two guys who did it and working with a bunch of editor who where providing the content, as they were doing that they realized that they needed a framework and they sort of grew a framework out of their first application. As they (??) what kind of things their editors were constantly asking them to them change to the site, they developed more flexibility in all those areas. And at some point they said let’s open source it and they got support from the newspaper. And then a very interesting thing hapenned. I suppose the newspaper is still using Django in some form (they are, and in fact they are selling the CMS they build). I think both of the original developers are no longer working there and they started Django the Open Source Project and what I found really great about that is I talked to those guys a couple of times and see them give presententations and I’ve seen how they work, and they really get open source. And they have a good license, but in my view even more important is the whole process, the way they work with the user community, the way they answer, they find a ballance between chaos and democracy and anarchy and sort of between Cathedral and Bazaar. They let lots of users add new features and provide ideas without losing the original thought and flexibility of the framework and I can think they are really doing a fantastic job at making Django a better product that goes way beyond what that original Kansas newspaper needed.

(now they talk about the Django vs Rails benchmark and how Django is an order of magnitude faster than Rails…)

LL: I will have to take a look at Django, because that’s pretty impressive.

GvR: Absolutely, I highly recommend it.

And yesterday (2006-08-17), at least two sources (Titus Brown and The Third Bit) are talking about what the BDFL said in SciPy 2006:

  • Django is the web framework.
  • It won’t be included in the standard library because of different development cycles, but will (should?) be as “standard” as PIL or NumPy
  • He hopes that Django and TurboGears will converge

There is a discussion about this on reddit.

What do you guys think?