views:

1489

answers:

1
+1  Q: 

Django on CentOS

I'm looking to use Django on a shared host that's running an unknown version of CentOS. My main problem is trying to interface with a database. The server has MySQL installed, but not MySQL-python. I initially thought of suggesting running "yum install MySQL-python", but apparently the version of MySQL-python that's in the default repositories for CentOS is 1.2.1, and Django requires 1.2.1p2.

This requirement first started with Django 0.96. In the release notes, a deprecated interface called mysql_old was added for compatibility with older versions of MySQL-python. Last July this deprecated interface was unceremoniously dropped. The announcement of this change does not indicate a reason other than that it was old.

Is it possible to resurrect this old interface in Django 1.1? Have there been any changes to the database interface since then? What would be the danger in forcing Django to skip the version check and using 1.2.1? Is it possible to compile a later version on another machine and copy the files over to the host? What would I need to know in order to do that?

I also looked into SQLite, but CentOS ships with Python 2.4.3, and therefore would require the pysqlite2 extension, which (afaict) doesn't exist in the repository.

Everything could be solved by simply installing from source, but that's rather messy and I have a much smaller chance of convincing the company to do that than getting them to install something from the repository. I realize that it seems like I should just get a different host, but you'll have to trust me that I have my reasons to try to make this work.

note: I don't have any experience using CentOS or yum, so everything I've said about them is an informed guess. Please let me know if all I need to do is specify some settings or change repositories to get the updated versions of these packages. Thanks.

A: 

You can actually manually install the mysql-python adapters without compiling anything, if you can't get a recent package from the centos repos. Just download the mysql-python tarball (from the sourceforge site). In the tar ball are all kinds of setup scripts, readme's, etc. You can either run the ez_setup file, the setup file, or, just copy the MySQLdb directory to somewhere in your pythonpath. I think on centos, /usr/lib/python2.4/site-packages/ works.

Good luck!

Alex
I tried that at first, but MySQLdb needs a low-level driver that has to be compiled. However, compiling it in a VM and copying it over to my host seems to have done the trick.
Kyle Cronin