HOWTO deploy Django in Jumpline

The blogosphere discussed the headache of deployment for modern Web Framework on shared hosting recently in couple weeks ago. This HOWTO documents the bumps and workaround in deploying Django to Jumpline’s VDS(Virtual Dedicated Servers) hosting.

Compared with the ironclad shared hosting, VDS provides SSH access, and private Apache server. Jumpline’s plan is also shipped with mod_python(python 2.5) and write access to PYTHON/site-package and /usr/local/bin, that make the whole process less painful.

Setup the VirtualHost

Add a sub-domain as in VDS console as our testbed.

Install Django SVN

It is a pity that Subversion is not installed in the chroot jail. In fact the Subversion hosting is a premium feature you need to pay for. Anyway, we can just check out the code in the local machine, then copy it back to the server. In the server:

python build
python install --prefix=/home/lib

If you happen not to have write privilege PYTHON/site-package, you may consider add –prefix to override the default installation path, then add the prefix to your PYTHONPATH environment variable.

Setup the mod_python

Load mod_python in httpd.conf

LoadModule python_module modules/

As the name suggests, is a feed aggregation portal based upon FeedJack, some enhancement are in plan to scratch the etch, now it is just mere a simple deployment:

<VirtualHost *:80>
    DocumentRoot /var/www/planet
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    PythonDebug On
    PythonPath "['/home/projects'] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE feedpipe.settings

    <Location "/media">
        SetHandler None
    <Location "/static">
        SetHandler None

/media and /static are set to host static media contents. /media is mere a soft symbol link to django/contrib/admin/media. We also link /static/feedjack to feedjack’s media files as FeedJack’s document suggests. Here is the feedpipe.settings:

MEDIA_ROOT = '/var/www/planet/static'
MEDIA_URL = '/static/'

Restart httpd, done.