Introducing Django
You may know that I spent a year working in Kansas for a local newspaper—the Lawrence Journal-World. I’m delighted to announce that a decent chunk of the software I worked on there is now available as open-source, in the form of the Django web framework.
Django is an MVC Python web development framework with a strong emphasis on content management. While comparisons with Rails are inevitable (I plan to post one myself shortly), it should be emphasized that Django is by no means a clone of Rails—in fact, development on Django started in October 2003, months before the first public Rails release. That the two frameworks share so many ideas is, I feel, a testament to the design of both.
Django was initially developed by Adrian Holovaty and myself, with Jacob Kaplan-Moss joining the team shortly before my departure. The framework evolved during the construction of a number of sites, which included:
- 6newslawrence.com, local TV news, the first site to launch using the then nascent Django framework.
- lawrence.com, a local entertainment site. Every town should have a site like this; sadly, very few do.
- VisitLawrence.com, a local tourism site.
- KUSports.com, a sports news site covering the University of Kansas.
- LJWorld.com, a local news site and the flagship for the Journal-World.
It’s also purring along under the hood of chicagocrime.org and the Django project site itself.
Adrian and I developed Django to allow us to create reasonably complex database driven web applications in as little time as possible. A local newspaper produces a huge amount of information—news stories, events listings, obituaries, sports results, marriage announcements, photo galleries, polls, weather reports and dozens of other bits and pieces. To maximise their value and potential for reuse, these things need to be stored in a database. That database needs a user interface for people to add and modify content, and of course the information needs to be published to a website somewhere.
Django automates most of this—and makes the rest as easy as possible. You create a data description (kind of like an SQL table schema but with additional information about validation rules and interface widgets) and load it in to Django. Django then creates the database tables, model classes and a comprehensive web-based administration interface for your site’s staff. All that’s left for you to do manually is the code for the public site, which is generally a case of writing a few lines of controller code, configuring some URLs and knocking out some templates.
To give you an idea of how much this speeds up the creation of new sites, consider the case of Game. Game was a site created to provide detailed coverage of little-league games in and around Lawrence (for non-Americans, little-league is baseball and softball for children aged around 5 to 11—it’s amazingly popular). The entire Game site, including news, fixtures, match results, team profiles and even weather forecasts for forthcoming matches took two days to develop.
I haven’t been involved with Django since leaving the Journal-World back in September, but now that the framework is open-sourced I look forward to contributing to its further development—both in terms of documentation and actual code. There’s already plenty to look at on the Django site (designed by the ever-talented Wilson Miner); I suggest the overview as your first port of call.
Expect to hear a lot more about the framework in the next few weeks.
Tomas Jogin - 17th July 2005 13:05 - #
Mike - 17th July 2005 13:07 - #
Paul Bx - 17th July 2005 19:12 - #
Simon Willison - 17th July 2005 19:55 - #
Ping - 17th July 2005 21:52 - #
J Breen - 18th July 2005 00:41 - #
Jesus. Another troll. Yawn.
Jeremy Dunck - 18th July 2005 05:49 - #
Great, finally :) I have been watching your wfw for a while and believe that this will be the killer ONE.
And now it needs just more marketing (in order to compete with Rails).
And to be honest - django website is at www.djangoproject.com, yet the logo is just django.
rdk - 18th July 2005 09:26 - #
I'm a PHP developer and I've created a pretty good framework for myself over the years that I'm pretty comfortable with. However, I like to look at other frameworks for ideas and I like to be open to the idea that I might just find a framework that would make me want to just drop mine entirely. I will be sure to do some investigating. I hope it's not as hard to install on my Powerbook at Ruby on Rails as been (still haven't got it going). I have a natural affinity to Django because you worked on it while in Kansas and I currently live and work in Kansas. Although you did live in a rival town! I'm the web manager for http://www.capd.ksu.edu.
At any rate I have some questions that maybe you could answer in your next article about Django or in the comments?
Brent O'Connor - 18th July 2005 16:18 - #
Jeff Croft - 18th July 2005 17:14 - #
For the record, Brent meant me as a .NET bigot. :) My point was: every framework works best with the specific task(s) it was designed for. For example, Mike Davidson wrote about them using Java Tea and Kettle at Disney. I liked thier scripting language, but it would've taken quite a bit of effort to retrofit it to a blog, for example.
Still, I'm curious to see what you say to Brent's other two questions.
Milan Negovan - 18th July 2005 20:14 - #
However, the references to learning from PHP worry me a great deal - since, from my (highly jaded) perspective, PHP is a great platform to write security holes in! By this point I'd expect framework designers to realize that "cross-site scripting exploits" need to be averted by default, just from the continuous stream of "oops, another big PHP app exploited" messages that have gone by. I haven't seen this mentioned, does anyone know if it's been considered? (Or is otherwise a non-issue that I shouldn't be worrying about?)
Mark Eichin - 19th July 2005 00:45 - #
Mark: One of the things we learnt from PHP was how to make writing security holes harder! I'm not saying you can't create them in Django, but the two most common (XSS and SQL injection) have counter-measures built in to the framework.
On to Brent's questions:
What are the advantages over using Python over PHP and Ruby?
I'd say Python and Ruby are pretty much neck and neck - they're both superbly well designed languages, they both have good standard libraries. Python just beats out Rails on size of community and available code for doing cool things, but Ruby's catching up pretty fast there.
PHP on the other hand has some serious problems - the most noticable being the lack of namespaces or modules which makes building large applications hard and integrating lots of code from other people a mine field. While it beats Python and Ruby on deployability (virtually every web host supports it these days) it loses out in the language design stakes. I think you'll find it hard to find anyone - even the most ardent of PHP hackers - who will claim that the language itself is better designed than Ruby or Python.
What are the advantages of Django over Ruby on Rails?
I'm going to write more about this shortly, but right now Django's two advantages are that it's Python (hence slightly bigger community and availability of cool code) and that it comes from the CMS world, so it handles the creation of boring administration screens for you. Rails has scaffolding but it's not meant as a final interface. Rails has plenty of advantages over Django - like the fact that Rails isn't a pre-release "hackers and early adopters only" project right now!
What do you say to those bigots that won't give it the time of day because it's not Java or .Net?
Go read lesscode.org ;) Dynamic languages offer productivity gains over their static cousins. If you don't believe this, it's your loss!
Simon Willison - 19th July 2005 03:19 - #
Thanks for the link, Simon. Will keep an eye on it.
Milan Negovan - 19th July 2005 16:46 - #
Daniel Talsky - 19th July 2005 19:15 - #
Simon,
Thanks for the reply. BTW, it was nice meeting you at SXSW 2005. I'm going to really have to dig in to Python and Django soon.
It would be cool for you to share some of these community websites that are out there for Python. I've looked at Python a little bit and one thing that I don't like is that the main website for Python.org just plain stinks and I don't think it is as near as good as php.net. That's just my humble opinion though.
Milan,
I wasn't referring to just you... I know other Java and .Net bigots. I work at a University remember! :)
Brent O'Connor - 21st July 2005 14:20 - #
James Dam - 2nd August 2005 02:06 - #
John - 8th May 2006 21:11 - #