Moving my blog to Django

I’ve been meaning to move my blog to Django for about 2 years. I’ve got plenty of UI mockups, I just haven’t got around to coding anything. I decided instead to look at some of the pre-existing Django blog applications. It turns out there are at least a few that are quite complete.

Candidates

Django has been open source for over 2 years now, but it’s way behind something like Rails or PHP when it comes to packaged software. If I want a PHP blog, Wordpress is simply a great choice and there are many, many others. By stipulating Django, I’m narrowing the field quite severely. This may be because it looks trivially easy to build a blog in Django, and most people just roll their own.

After doing a bit of searching I unearthed these great projects.

  • Banjo
    A project that aims high: plugins, XML-RPC editing, importers, I’m just not sure how much of the functionality is stable.
  • BlogMaker
    A pretty complete app, sadly supports Django 0.96 only (see Trespams).
  • ByteFlow
    Perhaps the most complete and active Django blog project (thank you to Simon Willison for pointing me to it).
  • Coltrane
    James Bennett’s blog tool, building on his django-comment-utils and django-template-utils projects.
  • Django Basic Apps blog
    Part of a larger suite of tools, this blog app isn’t as basic as it’s name makes out.
  • Django Project site blog code
    The original Django blog app and surely a starting point for many personal sites.
  • Diário
    A more internationalised take on the Django blog app.
  • Geeksite
    A whole geek site app featuring blog, CV (resumé) and project list.
  • Trespams
    A fork of BlogMaker which targets Django SVN but also attempts to be more like WordPress.

Some notes on software re-use

There is a low barrier to entry for starting a Django application. It’s very easy to create some models and check them in to Google Code. Creating a rounded reusable product takes much more. I had previously been sceptical about the completeness of the code on offer.

I have been reading Robert Glass’s excellent Facts and Fallacies of Software Engineering. He cites several studies which show that if 25% or more of a piece of software is not appropriate to your needs, then it is more cost-effective (in terms of time in my case) to start from scratch. If I modify one of the above apps, I become responsible for merging downstream bug fixes and maintaining my forked version. It would also be possible to take code from many apps to create the “perfect” blog tool, but I wouldn’t have access to improvements made by other people. It therefore is important to select a application that is a very good match for my needs off the peg. See Fact 19 in Facts and Fallacies of Software Engineering for a longer discussion of these issues.

There are certainly many more Django blog apps out there. I did not conduct an exhaustive search. These apps have been linked to from either the Django Resources page or I have seen them mentioned in previous reading. That a blog app came to my attention without much effort suggests a certain level of activity and so provides a valid filter for less advanced projects.

My requirements

The features I require:

  1. Write entries in Textile.
  2. Use the admin to write and edit posts.
  3. Pretty urls e.g. /2008/jun/01/moving-my-blog-to-django/.
  4. RSS feeds for posts, tags, ideally comments.
  5. Tags with tag cloud and items-with-tag views.
  6. Categories. I blog about hacking, cycling, business/startups, personal stuff and more. These posts have separate audiences.
  7. Comments with moderation.
  8. Write-edit-publish workflow to allow incremental authoring of posts.

Some nice to have features:

  1. Search (required, but trivially easy to build).
  2. Open ID authentication for commenting like Simon Willison has.
  3. Highlight source code snippets (this can be done in JS, e.g. SHJS).
  4. Ping Pingomatic on post.
  5. Sitemap generation.

I think lifestream applications like FriendFeed and tumble logs are very cool and I would really like my own one. Moving the blog to Django is the first step in building my own lifestream site. It gives me the foundation to build code on.

Django blog apps compared

Features 1-5 are found in every application considered here or can be added without modification to the core application, so I will omit them from the comparison matrix.

  Categories Comment mod Workflow Tag pages Search OpenID Highlighting Ping Sitemap Active project
Banjo N Y Y Y N N N Y N Updated Nov 2007
BlogMaker Y Y Y Y Y N N Y N Y
ByteFlow N Y Y Y N Y Y Y Y Y
Coltrane Y Y Y N N N N N N Basic maintenance
Django Basic Apps blog Y Y Y Y Y N N N Y Y
Django Project blog N Y N N N N N N N Basic maintenance
Di‡rio N N Y Y N N N N Y Y
Geeksite N N N N N N N N Y Updated Jan 2007
Trespams Y Y Y Y Y N Y Y N Updated Dec 2007

Conclusion

Although my feature matrix is skewed to my needs, it shows that the state of off-the-shelf Django blogging applications is improving. We certainly don’t have a WordPress or a Moveable Type yet but hopefully these applications will gain more attention leading to more feature contributions.

The matrix doesn’t really capture the different levels of work that have gone into the projects. I spent a bit of time looking at source code and their is a fair amount of variation. Diário and BlogMaker in particular are clearly more advanced than the average blog app. The Django Basic Apps project blog and Coltrane also appear fairly complete.

A big plus for many of these applications is how they integrate with other open source Django code available. django-tagging and django-comment-utils are almost ubiquitously used. An honourable mentioned has to go to Pinax/Hotclub, a really interesting project to create an integrated suite of applications that can be used to build a site on Django. There’s lots of code there, but a blog app is currently conspicuous by it’s absence! Any of the above applications would be an excellent choice for inclusion.

So which tool will I use to power my blog? I’m going to install ByteFlow locally and have a good play with it. If it is not a good fit or there are show-stopping issues, I may also install Trespams, the Django Basic Apps blog and possibly Diário or Coltrane.

Edited Jun 4, 10:30: Added ByteFlow (thanks Simon!)