Python vs PHP
ianb at colorstudy.com
Mon Jul 7 22:01:12 CEST 2003
On Mon, 2003-07-07 at 05:47, Catalin wrote:
> Can Python replace PHP?
> Can I use a python program to make an interface to a mysql 4.X database?
> If that's possible where can I find a tutorial?
Unlike PHP, Python does not have a single model for creating web pages.
See http://www.python.org/cgi-bin/moinmoin/WebProgramming for a slightly
intimidating list of options. If you feel comfortable with PHP, I would
advise using a similar system in Python, probably Spyce. Webware also
has a PSP component, which is slightly more like JSP than ASP (and PHP
is more like ASP). I believe mod_python will have a PSP option (but I
don't know where or if it's finished).
What you should remember when moving away from PHP, is that you no
longer have to use the server-page metaphor -- most of your application
logic should be in plain Python modules. Then you'll use your PSP (or
similar) page to present that code and respond to user input.
Python has good database access, look for MySQLdb, and the DB-API
documentation applies as well. There's several wrappers to make
database programming easier, see:
For MySQL there's my own wrapper, SQLObject, as well as MiddleKi, PyDO,
and dbObj. For something a little lighter you might want to try SQLDict
for ll.sql -- I think you will find even these simple wrappers will take
a huge weight off your program compared to normal PHP MySQL usage.
More information about the Python-list