Infinite (Django) and Wordpress: A Comparison
Posted in Django
on October 28th, 2009 by
Stephen DeGrace
Infinite, the Django application set (I don't want to say "application," because a Django site is actually a set of applications linked by a settings file) that runs infiniterecursion.ca is basically feature complete. This seems like a good time to step back again and consider what I've made.
(By the way: If anyone wants any of the apps that make up Infinite, email me to let me know. I'll be happy to share. Use at your own risk, and I would appreciate if you share back any improvements you make. FWIW, I might open source the whole thing when I get a chance.)
Infinite is basically a Django CMS. It's not the fanciest CMS in the world, but I like it because I made it myself (with the help of Python and Django, plus a slew of other tools I borrowed from others, including django-filebrowser, django-tinymce (and hence TinyMCE), Pygments, PIL and jQuery). Part of the point of making my own web site was to have everything exactly the way I wanted, and more importantly, as a form of hobby programming.
Infinite isn't a bad app, actually. But having created Infinite and worked with Django, and having also done extensive work in PHP and having worked with WordPress, phpBB and Joomla, I feel that I have a decent perspective to compare the various frameworks and applications.
The CMS that Infinite is most comparable to is WordPress.
Infinite supports multiple blogs with different access to different groups of users, one-off pages, site-based email forms, comments with a moderation system and reCaptcha-based captcha to prevent spam (email forms similarly protected), photo galleries again with different access to different groups, a refback-based linkback system which is fully moderated to prevent spam, hitcounters, and a good user/group/permission system via Django auth application. There is also RSS and an arbitrarily deep tree-based mavigation system supporting an arbitrary number of menus.
Search is provided via a Django app wrapper around a Google CSE. Blogs have many views, and Pygments-based syntax highlighting is available when blogging about code (albeit the usage is awkward with TinyMCE. It works great if you know what to do, but it's hackish. Basically, you paste in the code so that you get the appropriate linebreaks and 's from TinyMCE, then edit the HTML, find the p block, change it to a code block, and set the lang attribute to the language you want highlighted).
When blogging, you can conveniently insert photos via filebrowser, and the gallery app creates a set of thumbnails of different sizes when you add pictures to a gallery. It actually senses when the gallery is changed, finds the pictures that have been added or deleted, and for new pictures, it sets up a background task to create the database entries and the thumbnails. That's another thing: for programmers, there is a general mechanism to queue tasks for background processing. Infinite also enjoys the Django admin interface, and some admin-like features on the front page for ease in blogging, uploading photos, moderating refbacks, etc.
WordPress I think has basically all these features and many more (one big one pops to mind that was never a priority for Infinite but is a good feature to have: a calendar), or can have them with plugins (maybe not so easily the syntax highlighting, but this is a rare desire I think except among tech bloggers). WordPress is not by default a good multiuser environment, but it is fairly trivial to set it up so that it is. WordPress has tagging and Infinite doesn't even have the concept, but could easily acquire it (would not be hard to do, just not something I use, so I didn't think to do it).
Now let's look at some places WordPress shines, and I would be hard pressed to match its functionality.
WordPress has a very dynamic and Javascript-y back end. This would be enormous work to replicate. Unlike the Django admin back end, which creates a rudimentary but very useful administrative interface by exposing your models as forms, the WordPress admin is focused on the site as a cohesive application and is much more flexible and user-focused. It's that old thing about how the Django admin gives you 95% with very little work, but if you want that last 5% you pretty much still have to roll your own. For me, though, 95% is good enough, and in a few cases I did indeed roll my own and link it into the site front end.
A key (and interesting) thing is that WordPress is modular in a way that Infinite fundamentally isn't and maybe can't be. With WordPress, you can swap in and out "modules," little blocks of widgety feautures like the stuff you see on the right sidebar of this site into various locations on the page by dragging and dropping in admin. That is only possible in Infinite by editing the base.html template directly. Fundamentally, because of the way Django templates are rendered, it is hard to see how the WordPress functionality can ever be duplicated on a Django site without creating a very serious application.
Template tags for positions would need to be created, and those tags would have to check the database for the content they should display (applications would have to have something like the admin.py that tells this application what widgets they expose and how to find the template code to display them) and then find and render the appropriate template code. It could be done, but Django is not designed with this type of templating in mind.
Then there is the ability to swap in and put more serious chunks of code, themes (templates plus css plus images to totally change the look of the site while still displaying the same highly customizable content) and plugins (basically, the equivalent of whole Django applications). Of course you can do this in Django. You do it by hand. But in WordPress, you can go to a place in the admin, see a list of plugins fetched via AJAX, select one, download it, and start using it right away. It is extremely hard to see how this could ever be done in Django, especially when running in the recommended configuration behind Apache with media served separately.
Last but not least, a person with the most tenuous intelligence and computer skills can succeed in setting up WordPress and using it. If you're smart enough to get hosting that supports PHP, you can probably handle WordPress. Even if I packaged up Infinite with a pretty bow, you could never install it and get it going with such ease, and due to the aforementioned problematic theming, you had better be prepared to roll your own theme.
The bottom line is that Django is for serious hobbyists and developers of medium size to large professional sites that have real, permanent design teams. Stuff like WordPress or Joomla is awesome for individuals and small organizations that can't afford to have a web programming and design team. Of course, their deficiencies become apparent when you try to use them for something more professional... in those kinds of circumstances you need to be able to get the look and behavior of the site exactly the way you want it and have everything fully under your own control, and in trying to be generic and accessible, the big PHP frameworks fall flat. For a full-time developer, a framework for writing anything you want exactly how you want (a CMS, intranet, news site, etc.) is probably superior to someone else's generic finished application.
This is the area where Django shines. Django and I think by extension Python are therefore never going to compete with the big PHP applications any time soon, even leaving out the fact that PHP is much better supported on most hosting platforms, but Django, RoR, etc. have an important niche for making a smaller number of really powerful and notable web sites.
I know it's only a dream, but I wish that a really good full-featured blog or CMS application with features like plugins, switchable themes, and widgets that can be placed without editing templates existed for Python written in a great framework like Django. (By the way, for the record: Django is the only existing Python framework that comes close to being modular. It is this reason and this reason only why Django is the sole serious contender for Big Python Web Framework. Without modularity, the others are a waste of time for any real site that isn't a very specific single-purpose application). Then I wouldn't have to go back to working with PHP when I set up web sites for small organizations and do customizations, modules, etc. Python has no web application "For The People," and I think it's kind of a shame.
Comments:
There are 3 comments on this item.
On March 29th, 2010
Stephen DeGrace
wrote:
I agree that it is definitely possible, and I think it would be awesome if someone did it, or one of the existing projects like django-cms evolved to that point. I think it would be hard to do, though - for one thing, I would love to see someone describe a plausible way to implement "skins" or themes in Django for such an app.
I'm actually working on an app that I think models a part of what that theoretical application ought to have, a menuing system of trees of arbitrary recursive depth for creating menus and blogrolls, plus a way for applications to publish content that a user can graphically drag and drop into his trees. I'm using django-treebeard and the jsTree jQuery plugin. It replaces a similar, home-rolled system where to permalink internal content, you had to have intimate knowledge of the internal structure of the content, and of the link objects.
So far, I have the publishing system worked out, I have an API to allow applications to have a links.py file where they export their links, and a tree-interface to display the links exported, plus the tree API itself. Now for the hard part, a natural and intuitive interface for building menu trees from this exported content, plus hard-coded links.
And that kind of goes to the heart of the thing eh... for people like us, a huge part of the fun is building the thing, so while we might find a real, fully-modular CMS/blog application for Django, we might now want to actually use it! :) I wish it existed, though, because I would definitely use it for clients, instead of PHP apps!
On March 29th, 2010
Stephen DeGrace
wrote:
*not want, I mean :)
Post a Comment
* Required field, your email will not be posted.
On March 29th, 2010 Charles Bodman
wrote:
I like the post. I just started my journey into creating a blog via Django. Im loving it so far. I agree with you, it would be awesome to come across a full modular blog built via Django. I think its definitely possible.