Henrik speaking at a conference

Hi, I’m Henrik Joreteg

Mobile web consultant, developer, and speaker

all posts | twitter | email | hire | book | tutorials

The Case for Using Django Instead of a Pre-Packaged CMS


We’ve been exploring options for content management systems at work. So far, I’m failing to see any significant benefits of a CMS over simply building the site in Django and customizing Django’s auto-generated admin interface.

This argument will not hold true for non-developers. If you’re just looking for an out-of-the box solution for a simple site with less than 50 pages and you’re not looking to create lots of different layouts I recommend a pre-packaged CMS. One of the best is Wordpress.org (it’s not just for blogging anymore).

However, if you do need a highly customizable solution, I feel that Django is a better solution.

Here are 26 reasons:

  • I managed to build a functioning CMS in about 2 hours with less than 100 lines of code (not counting the html templates) that was functionally superior to my Drupal installation after I had worked on it for about 10 hours. (I’ve only been working with Django for about 6 months. With no previous Python experience.)
  • The main advantage of using a CMS is that it gives you a way to enter data without having to build an admin interface. That functionality is provided, pretty much out-of-the box with Django. It generates a brilliant, customizable admin interface for you based on your data models. When you develop in Django, you’re essentially creating a custom CMS without doing any extra work.
  • By rolling your own CMS, you get customize it to work just the way you want it.
  • You can mix and match. You don’t have to have your entire site be driven by the CMS. You can easily add other pages that are just defined in your Django application.
  • Django was initially built around a newspaper’s content-driven publishing needs. It’s designed to handle content.
  • Google, The Washington Post and The Onion all use Django in some aspect of their operations.
  • Django code is straight Python. Extending its functionality is as easy as dropping in any Python module (of which there are TONS).
  • Developing in Django is FAST because it is designed to require as little coding as possible. The same is true of Python, it is one of the pithiest languages out there. It uses very few brackets and tags, unlike the tag-based languages like PHP and ColdFusion. Instead it uses linebreaks and whitespace. This also means there isn’t as much syntax to remember or type.
  • Python’s basic structure forces developers to write readable code! No more; “what on earth is going on here’ when rebuilding someone else’s messy ColdFusion site. In some cases with Python it almost looks like you’re reading pseudo-code.
  • The Django tagline is very telling about their development philosophy: "The web framework for perfectionists with deadlines.” It sounds like it was built just for me.
  • Django comes bundled with a powerful ORM (object relational mapper), which uses the same model definitions that help define your admin site to generate the needed database tables. In the code you can then use a database record like you would an object. Manipulating object from the database is very intuitive and doesn’t require you to write ANY SQL, unless you’re getting really fancy. Django’s ORM follows the Active Record design pattern.
  • Django Works with: MySQL, SQLite3, PostGreSQL, there’s also a Python adapter for MSSQL server, although I’ve read that the MS SQL server is not yet super stable.
  • Django has built in support for internationalization in both code and templates. It can even handle locale specific date formats and languages that read from right to left!
  • Python is relatively easy to learn because the syntax is so minimalistic. There’s even a great free online book to get you started.
  • Django is stable and is being very actively developed, the user community is growing rapidly. Plus, there’s a huge Python community already.
  • Comparisons show that building sites in Django is even faster than Ruby on Rails.
  • Django’s architecture is inherently very pluggable. For example, if I wanted to add blogging functionality to the demo CMS I built, It would be really easy to plug it in, in a few minutes. (styling the templates is what would take a little longer).
  • You can define very granular permissions to establish a publishing work-flow that meets any logical requirements.
  • It’s all open source and it runs beautifully on Apache/mod_python.
  • Built-in support for running multiple sites from one admin.
  • Django is built, from ground up for perfect URLS. ALL URLs are decoupled from the content. They’re pointers, not absolute references to specific documents. This allows for greater flexibility, you can restructure your site, or even change to a different server technology without breaking your old links.
  • Powerful caching capabilities, very granular if desired. Compatible with memcached for lightning fast caching.
  • Includes a very robust inheritance-based templating language that helps template developers practice the DRY principal which helps enforce consistent styling across related pages and sites.
  • There is very clean code separation between the templates and the Python code, makes it easy to separate work of designers and developers.
  • Python’s inventor Guido van Rossum who is arguably one of the smartest developers out there calls Django his favorite web framework.
  • Jeff Croft also wrote a great article about using Django instead of a traditional CMS.