October 24th, 2004, 01:33 AM
python and mysql
i am trying to do my server-side stuff in python now instead of php because php just gets far too messy for my taste. so cleary i need to use databases and i just found out my server doesn't have the MySQLdb module installed.
and when i contacted them about it they said:
i also have PostgresSQL on my server but i having a hard time figuring out what module or whatever i exactly need to work with it....
so anyway, my questions:
1. is there another way to access mysql besides MySQLdb?
2. what's the best way to work with PostgresSQL, if mysql is out of the question?
i don't do heavy database stuff, but i NEED a database to work with so i am just looking for...something.
October 24th, 2004, 06:21 AM
Both interfaces to MySQL and PostgresSQL use a compiled C extension which is where the problem lies. I found a pure Python interface here but I don't know how good it is:
My host is the same, it claims Python support but basically says it's there to support Mailman only.
Gadfly is a pure python database making no use of external technology and it has an SQL interface.
October 24th, 2004, 10:53 AM
Originally Posted by Grim Archon
okay, awesome - thanks
now in hopes of not sounding too stupid: how do i install these if i only have remote access to the server?
October 24th, 2004, 09:52 PM
If you have shell access (not necessarily root) then u can compile a mysqldb and update your sys.path to point to that directory.
Originally Posted by jacktasia
October 25th, 2004, 05:25 AM
unfortunately, i don't have shell access. any other ideas? / how to get those other modules working?
Originally Posted by kancha
October 25th, 2004, 05:56 AM
This applies to normal cgi files:
If you execute a python file in cgi-bin then that directory and possibly it's sub-directories will be in the path.
If you create a python sub-directory in cgi-bin and in that sub-directory create an empty __init__.py file you should be able to keep python stuff separate. You then put all your support modules into the python sub-directory.
Your modules would then have a prefix of python
To keep code compatible you could use:
import python.mymodule as mymodule
So for your particular problem, I suggest you install the package on a local machine and then copy the complete package (ftp) to the python sub-directory.
October 25th, 2004, 06:18 AM
awesome, thanks again grim ill probably end up doing that.
Originally Posted by Grim Archon
i am seriously considering signing up for Plan 1 at http://www.python-hosting.com/ because it has most "common" modules installed and gives you shell access to install anything you want...seems like a pretty awesome deal, any comments on it?
October 25th, 2004, 07:17 AM
Looks like you have your problem sorted with that host and it looks a good deal
It's maybe a surprise but I went for all round quantity over specific python support with Lunarpages. (They specifically exclude Zope/Plone). I'm still in the site building phase (learning Mambo) at the mo' but haven't run into any issues except the C extension one.
My Python code markup cgi works from that site so at least I know all the core modules are available. (I'll add C module compilation to the list of experiments to try on it).