Wednesday, January 21, 2009

Django-Jython: Working With Experimental Database Backends - Part 1

This is the first of several blogs that I plan to publish regarding the use of experimental database backends with the Django-Jython project. In this series of blogs, I will cover the basics of how to begin using the experimental backends, as well as some details on how to create your own. At the time of this posting, only one "fully supported" backend exists for the Django-Jython project and that is for the PostgreSQL database. However, another experimental backend exists for SQLLite and there are more on the way.

In order to build and begin using the experimental backend for SQLLite (or others), you must first obtain a copy of the code, which is available on the project site, or via your command-line using the following line:

svn checkout http://django-jython.googlecode.com/svn/trunk/ django-jython-read-only

Once you've obtained the code, it is easy to build. Simply traverse into the root directory of the downloaded code which should be named "django-jython", and perform the build using the setup.py build script as such:

jython setup.py build

Now, this works nicely for a build to use the PostgreSQL backend, but it will not include the experimental backend implementations. In order to do so, you must open up the setup.py script and add the experimental backend that you wish to use within the "packages" listing as follows:


from distutils.core import setup
setup(
name = "django-jython",
version = "0.9",
packages = ['doj',
'doj.backends',
'doj.backends..zxjdbc',
'doj.backends..zxjdbc.postgresql',
'doj.backends..zxjdbc.sqllite', # Experimental backend
'doj.management',
'doj.management.commands'],
...



Once you've added this to the setup.py script, it will cause the experimental code to be built the next time the build process is invoked. Now you can begin using the new backend.

Next time I plan to delve into the process of creating your own experimental backend for the Django-Jython project!

No comments:

Post a Comment

Please leave a comment...