LinuxLaboratory woes, Drupal -> Django?


So, today I tried browsing to one of my sites,, and found a 403 “Forbidden” error. Calling support, they said it was a “billing issue”. Well, I pay my bills, and I haven’t received any new credit cards, so I’m not sure what that’s about. Further, they haven’t contacted me in any way shape or form at all in a very long time, and I’ve had the same email addresses for years now. Last time they failed to contact me, it was because they were sending all of the mail to “root@localhost” on the web server.

What’s more, the tech support guy, having determined that this wasn’t a technical but an administrative problem, transferred me to a sales person who was not there. I left a message. That was 3 hours ago. So I took matters into my own hands and changed the name server records to my webfaction account, and now points to an old test version of the site that uses Drupal.

It’s Over Between Us…

Drupal holds the record for the CMS that has run LinuxLaboratory the longest. Since its launch in 2001, LinuxLaboratory has used all of the major, and some of the minor open source PHP CMSes. Drupal gave me something very close to what I wanted, out of the box. Nowadays, Drupal is even nicer since they redid some of the back end APIs and attracted theme and module developers to the project. I’ve even done some coding in Drupal myself, and have to say that it really is a breeze.

But the problem is this: I’m a consultant, trainer, and author/editor. I am an experienced system admin, database admin, and infrastructure architect who makes a living solving other peoples’ problems. I really can’t afford to have something that is super high overhead to maintain running my sites. With Drupal releasing new versions with major security fixes once per month on average, and no automated update mechanism (and no built-in automated backup either), it becomes pretty cumbersome just to keep it updated.

This is in addition to my experiences trying to do e-commerce with Drupal. I tried to use one plugin, but soon found myself in dependency hell — a situation I’m not used to being in unless I’m on a command line somewhere. So, out with Drupal. I know it well and I’m sure I’ll find a use for it somewhere in my travels, but not now, and not for this.

Is Django the Future of LinuxLaboratory?

So I’m thinking of giving Django another shot. In fact, I thought I might try something new and interesting. Maybe I’ll build my Django app right in front of everyone, so that anyone who is interested can follow along, and so people can give me feedback and tips along the way. It also lets me share with people who have questions about a feature I’m implementing or something like that.

For fanboys of <insert technology here>, know this: I’m a technology whore. I consume technology like some people consume oxygen. I love technology, and I get on kicks, and every now and then, a “kick” turns into a more permanent part of my tool chest. Python is one such example. I’ve done lots with Python, but have never really made friends with it for web development. I got a webfaction account specifically because they support Python (and Django). I’ve done nothing with it. Now I think I might.

But not to worry! I own lots of domains that are sitting idle right now, and I’m considering doing a Ruby on Rails app for one of them, and I’m dying to do more with Lua. There’s only so much time!

Webfaction Django Users: Advice Hereby Solicited

So if you’re a webfaction customer using Django, please share your tips with me about the best way to deploy it. I’ve used nothing but PHP apps so far, and found that rather than use the one-click installs webfaction provides, it’s a lot easier to just choose the generic “CGI/PHP” app type and install the code myself. This allows me to, for example, install and update wordpress using SVN. Is Django a similar story, or does webfaction actually have an auto-upgrade mechanism for this? How are you keeping Django up to date?


  • Claus

    I’m not a Webfaction customer but the relevant tools for updates are Fabric, pip, and Virtualenv.

    So, you could use Virtualenv and pip to create a Python environment you need and get relevant Django apps directly from the VC systems. Then, you’d write a Fabric script to update your server. Just use the search engine of your choice for the details.

    Webfaction has also a forum that appears to be very good.

  • Martin Diers

    I run my own home-grown Django-based CMS off of webfaction. I love it.

    You will want to read through the webfaction help files on how to setup a domain, site, and assign it apps. I installed the generic mod_wsgi app. I did NOT install the webfaction supplied django. You will see why below.

    Here is my directory structure: ~/com ~/com/django-trunk ~/com/pythonpath ~/com/myapp

    ~/com/django-trunk is a Django SVN checkout.

    I symlink ~/com/django-trunk/django to ~/com/pythonpath/django.

    I put other python modules or apps I need in directories under ~/com. I symlink their main module directory into ~/com/pythonpath.

    I also symlink my django project/app into ~/com/pythonpath.

    Then, in my django.wsgi file, used to instantiate the app with mod_wsgi, I add ~/com/pythonpath to the python path:

    sys.path.insert(0, ‘/home/username/com/pythonpath’)

    In this setup, I can do an svn update any time I need to, on django-trunk or other such apps.

    After an update, you need to restart Apache to load the new code. Just issue a:



    and you’re done.

    This makes it very easy to do my development on my laptop (I use mercurial). It’s trivial to push up to my repo. Then, in my django app on webfaction, I just do a:

    hg pull

    hg update



    And my code is live.

    It’s a beautiful thing.

  • m0j0

    Ok, Martin, not only have I decided to take this route, but I’m also going to give mercurial a shot as well. I haven’t used it yet. I’ve used git, svn, cvs (forever), rcs (forever), but not hg or bazaar.

    Thanks a million for the tips.

  • James Bennett

    I highly recommend looking into Fabric (, which provides a simple Python-based mechanism for just the sorts of things you need to do (pushing code to a remote server, stopping/starting Apache, etc.). There are some other tools out there as well which can ease other parts of the pain of server administration, but Fabric’s likely the one you want to look at first.

  • Ray Cote

    I’ll concur with those saying Django deployment is quite easy on WebFaction. We’ve been using the mod_wsgi deployment since it was available (mod_python before that). WebFaction puts together a nice start-off framework that puts all the relevant links together.

    You’ll also want to add a WebFaction static to your site to serve admin and all your static files.
    I usually use the static link into my web tree so that I can keep all my files under version control.

    WebFaction gives you you’re own copy of Apache which sits behind the server-wide instance. The server-wide instance is what serves your static files, and is also a reverse proxy for your private Apache instance.

    Have about a dozen or so sites running on WebFaction right now and been very happy with them.

  • Iain Duncan

    I’m a pylons/repoze guy myself ( and an ex-Drupal developer ), but for your uses Django sounds like the best fit. I’ve done a couple of commercial sites in Django and it’s very well documented and easy to get up and going on.

    I absolutely hear your pain re Drupal. The release management has gotten out of control, and keeping on top of new releases and which contributed modules actually work winds up taking so much time, you might as well have used it for something productive like learning Django!

  • Dobes

    You might want to give WordPress another look, after my search I found that WordPress is the best one for me. The other one I like is CMS Made Simple but WordPress is more full featured and has more plugins available.

  • m0j0

    I love wordpress! I use it on this blog, on my beer blog, and on a few sites still in development. The autoupdate feature rocks, and most plugins I’ve ever seen work with a click, configure, and activate. Fantastic.

    However, I’m looking to do something different, and LinuxLaboratory is an opportunity to experiment. I’ve been wanting to do something useful with django for a long time, and to be honest, I haven’t seen a wordpress hack that makes wordpress suitable for what I’d like to accomplish with LinuxLaboratory (and I have seen quite a few slick hacks!)

    I hope to learn more about django, get to use a bit more python, and then I’ll probably take one of my domant domains and do a RoR site. I’m just like that. I like to tinker, and these aren’t money-generating sites, so… no harm, no foul!

  • m0j0


    Getting things set up as listed above by Martin is proving to be not quite a straightforward as I would’ve hoped. I think I have almost everything set up correctly. At first, I was getting the “It Worked!” page, but I realized that I was using an older version of django that was still linked in ~/lib/python2.5. Once I moved that django install out of the way, it found my svn checkout of django, but now I’m getting an error in my apache logs “no such module django.core.handlers.wsgi”.


  • Martin

    If you are getting that error in your apache logs, that means that it cannot find your django module at all. Are you sure you have django linked in to your local pythonpath, and have inserted that path in your .wsgi file?

    To test if it is working:

    export PYTHONPATH=”/home/username/com/pythonpath:${PYTHONPATH}”


    Then try:

    >>> from django.core.handlers.wsgi import WSGIHandler

    >>> WSGIHandler

    Django should not be linked into your local site-packages directory under ~/lib/python2.5 at all. The only location I have django is ~/com/django-trunk/django.

    Here is my .wsgi file:

    Here is what I have in my httpd.conf:

    I have ~/com/django-trunk/django linked into ~/com/pythonpath. Whatever version of python mod_wgsi is using, will look in my local pythonpath directory before checking any of the system python directories.

  • m0j0

    I figured that particular problem out, and it now appears that I’ll be able to have things my way! I’m currently following the 2nd edition of “Practical Django Projects”, and just discovered that it assumes everyone is using the dev server, which I’m not, so while actually getting the admin page to show up now works (proving that my setup is at least approaching sanity), getting simple things like admin media served forced me to go back and read not only django docs, but also webfaction docs. I just figured it out like 30 seconds ago.

    I created an app that is “static only”, created a symlink under that to my admin media directory, and mounted that under /static-media in my application (in the webfaction control panel). I reconfigured, waited a few minutes for the apache reconfig to take place, and now I’ve got my admin images 🙂

    Now to get my blog application (a standalone app that is part of the larger project) in svn, and I’ll be ready to go.

    Thanks a million for the input!

  • m0j0

    Oh! I forgot to say — the reason I was getting that error was because I had my sys.path.append line as the very last thing in my django.wsgi file. I moved it up and everything was fine :-/

    Sometimes I feel like a huge n00b.

  • Martin

    Another hint that you might find useful:

    Use a separate settings file for your production machine. I call mine

    Then, inside that file, I do this:

    from myapp.settings import *

    And then I override only the settings that need to change for my production server, like the DB setup, turning DEBUG off, etc.

    Then in my .wsgi file, I adjust this line to match:

    os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘myapp.prodsettings’