MLUG: Re: [MLUG] Python vs. PHP
Re: [MLUG] Python vs. PHP
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
> I've been learning Python to see if it might have advantages over PHP 
> for web development.  So far, the language looks pretty good.  However, 
> I have run into some issues:

Nothing wrong with using both.

> 1.  I would like to be able to embed Python code inside of HTML so I can 
> use it for templating the way you can with PHP.  I believe you can do 
> this if the web host supports Python Server Pages (PSP's).  However, my 
> hosting provider only supports standard Python CGI code.  Is there a 
> workaround?  Can I install PSP support myself if I lack root access?

I program my backends in Python and the frontends in PHP. Easy to keep 
UI functionality from being smeared in with your important stuff that 
way and you can let others do major reworks of the UI without them 
having access to freak up your backend code. I've played with embedding 
PHP in Python but haven't yet made that work to satisfaction.

> 2.  I am somewhat concerned about the performance of CGI having to load, 
> start, run and shutdown the Python interpreter with every CGI request.  
> Is there a workaround that might work with my hosting provider?

mod_python or Zope I believe stays cached inside the web server space 
more like PHP. Or you can run your Python code as a service that runs 
constantly and just connect to it from your frontend using a lil 
networking. Of course if you run either PHP or Python as CGI then yes 
it'll be slower and have more overhead.

> 3.  PHP has session management as part of its standard libraries.  Can 
> anyone recommend a good Python library for session management?

Depends how you're using Python. Session management is easy enough 
though. Check for a cookie, if the cookie doesn't exist make a new id 
and put it in the cookie, else read the id from the cookie.. save 
whatever data your saving with the id and timestamp.. if the time is 
past erase the data.. read or delete the session data as needed. You can 
write your own in half an hour if none of the existing methods please 
you. Structure your app so that you have it all running through a master 
script and then you can just have the master script work out the session 
stuff and pass the data when it loads the slave.

> 4.  Has anyone out there used Zope or Plone?  What do you think of them?

I dislike them both but know other people that love them.

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members