Friday, June 12, 2009

MediaTemple, Python and Django

Just installing Django on my Mediatemple dv account.

First, log in to SSH as root user. Then use subversion, provided by mediatemple in

WebControl > Root Access & Developer Tools > Install Developer Tools,

which must at some point be enabled to be accessible. Following this,

Subversion grabs the latest version to /var/trunk/django.

In the case of dv accounts, python packages are located in /usr/lib/python2.4/site-packages

Create a symbolic link between these two locations using

ln -s /var/trunk/django /usr/lib/python2.4/site-packages

then add another symbolic link to bring the underlying python script to the root of the django trunk:

ln -s /var/trunk/django/bin/django-admin.py /usr/local/bin

Basically, what is happening here is:

Django Source /var/trunk : Subversion project root

\ --> accessible to /usr/lib : Libraries for programming and packages
\ --> accessible to /usr/local : Local hierarchy

More on this. Now:

import django

and


django.version

voila!

Next, you must add the MySQLdb interface for python if you are planning to use mySQL as your cms database. Here's a good reference for once you have the tarball in your directory. However, I'd rather wget it directly from the sourceforge site. Here is the command to use from root SSH:

wget http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.tar.gz

Works fine. Now install the module and it should run without an error.

No comments: