Python & mySQL

Gerhard Häring gerhard.nospam at bigfoot.de
Tue Mar 6 01:29:05 EST 2001


On Mon, 05 Mar 2001 18:16:03 GMT, Colin Meeks <colinmeeks at home.com> wrote:
>Does anybody have any pointers for integrating mySQL with Python.  I've been
>using Python a while and am looking to develop a web backend using Python
>with mySQL.  My site is hosted by a Linux based ISP who has both Python and
>mySQL but they don't currently have a link between the two.  I'm using
>Windows2000 as my development base, so I want something that is usuable on
>both, so it's easier for me to track any problems.

You'll need the MySQLdb python module. A prebuilt Windows version is
available (at my homepage, see the sig).

If your ISP isn't so friendly and won't install the MySQL module for you,
you can still do that yourself if you have the correct binary version. For
Linux, you should only need to copy the following files in your cgi-bin
directory:

CompatMysqldb.py
CompatMysqldb.pyc
MySQLdb.py
MySQLdb.pyc
_mysql.so

I have done this successfully under FreeBSD and SunOS, where the ISP were
not flexible enough to install a Python module.

>
>Ideally I want something that doesn't involved recompiling Python if that's
>possible, 

You should never need to recompile Python for an extension module.

>as i want the installation to be as straightforward for my ISP and
>of course me :-)

As simple as
    python setup.py build
    python setup.py install
?

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de
web:    http://highqualdev.com



More information about the Python-list mailing list