#1
  1. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    Lawrence, Kansas [KU]
    Posts
    1,559
    Rep Power
    15

    python and mysql


    hey all,

    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:
    Sorry, MySQLdb was not installed on our servers. We can't install custom modules on our servers as you are on shared hosting environment.
    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.


    thanks
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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:
    http://sourceforge.net/projects/pysqldb

    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.

    grim
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    Lawrence, Kansas [KU]
    Posts
    1,559
    Rep Power
    15
    Originally Posted by Grim Archon
    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:
    http://sourceforge.net/projects/pysqldb

    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.

    grim

    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?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    23
    Rep Power
    0
    Originally Posted by jacktasia
    hey all,

    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.


    thanks
    If you have shell access (not necessarily root) then u can compile a mysqldb and update your sys.path to point to that directory.

    kancha.
    www.developers.net.np
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    Lawrence, Kansas [KU]
    Posts
    1,559
    Rep Power
    15
    Originally Posted by kancha
    If you have shell access (not necessarily root) then u can compile a mysqldb and update your sys.path to point to that directory.

    kancha.
    www.developers.net.np
    unfortunately, i don't have shell access. any other ideas? / how to get those other modules working?

    thanks
  10. #6
  11. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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.

    grim
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    Lawrence, Kansas [KU]
    Posts
    1,559
    Rep Power
    15
    Originally Posted by Grim Archon
    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.

    grim
    awesome, thanks again grim ill probably end up doing that.

    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?


    thanks again
  14. #8
  15. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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).

    grim

IMN logo majestic logo threadwatch logo seochat tools logo