eriksmartt.com>Selected Archives

Moving my blog from WordPress to Django; Part 1: Assemble the wheel, don't reinvent it

I was hoping to write this post as an announcement for my new blogging solution, but instead (since I haven't flipped the switch yet) I thought I'd start off with why I'm doing it, and what software I've pulled together to keep from reinventing the wheel. (In future posts I'll address the development itself, the unique features, and the major obstacles in moving from a WordPress installation on a shared server, to a custom web app written using Django. This last bit, the actual hosting of a Django app, is a significant one, as it is the primary issue causing a delay in switching over).

I moved my blog to WordPress software (from PyBlosxom, and a number of home-grown solutions before that) back in April 2005. I've been quite happy with WordPress, and would definitely recommend it for anyone who doesn't enjoy coding (and maintaining) their own web apps. After writing a few custom plugins and a plain, but functional theme, my WordPress-based blog has been churning reliably for well over a year. However, after also using Django for over a year to build other web apps, it became too tempting not to use Django for my own site. (It really is a great framework to work with, particularly if you're a fan of Python.)

Building a custom app isn't all roses and cherries. (I'm not sure what that means, but it sounds good.) With an established open source solution like WordPress, you have access to thousands of testers and hackers, all working to ensure that the software is reliable. You have access to good documentation, and plenty of bloggers who post solutions for custom integration problems. Furthermore, with PHP support being almost ubiquitous in shared hosting environments, you can have a WordPress installation up and running in a matter of minutes.

With a home-grown system, you do ALL the heavy lifting in development, testing, and maintenance, and in that regard, you're re-inventing the wheel in some areas, and leaving a community of support behind. Viewed in this light, it seems a little silly to build a custom solution when a proven, free system already exists. But custom apps can have their advantages if you can still leverage some open source communities while assembling a solution that is architected to address the specific needs you have. In my case, I tried to do as little custom, one-off engineering as possible (expect in the fun areas) while enabling a unique flexibility to re-think content interaction on my blog. I wanted the ability to prototype new feature ideas at the speed of Python + Django (which is to say, very fast) but not get bogged-down debugging ORM's and template engines. (I've spent plenty of time doing that in the past.)

Not wanting to write everything from scratch, my new solution is LAMP based (Linux [Ubuntu to be specific], Apache 2, MySQL and Python) using the Django framework for it's generated Admin CMS, object-relation mapping library, templating engine, URL mapping, etc. In other words, the only thing not leveraged from the open source community is the actual business logic of my app (which in a blog, can be quite simple.) I'm even leveraging external services like Akismet (for filtering comment spam) and del.icio.us flickr and Technorati for pulling in external content and metrics. I'm also using ElementTree (for the XML parsing in my content import system) Pygments (for syntax highlighting the code embedded in blog posts) simplejson (for generating JSON from Python objects) PyTechnorati (for accessing Technorati's APIs) the Universal Feed Parser (for pulling in external RSS/ATOM feeds) and the Yahoo! Interface Library (for the CSS Fonts and Grids libraries.) During development, I've also relied heavily on Subversion and Bazaar for my revision control needs.

With this arsenal of open source software, I was able to feature-match the bits I wanted from WordPress rather quickly, and then iterate on the presentation and interaction without the burden of implementing everything from scratch. Needless to say, I'm excited about the new site (it's been running parallel to my WordPress blog for several months) and I'm eager to see what happens when I finally flip the switch and start routing traffic to it!