if you are looking for a Python web development system that is "page- 
oriented" like PHP, two products out there for Python are Spyce and  
Myghty.  with these systems, you can link templates to apache using a  
small mod_python configuration in your httpd.conf file.  the default  
URL scheme used by both is like PHP - the url "http://myhost/foo/ 
myfile.html" points to a file called "/foo/myfile.html" in your  
server's htdocs root.

however both of these systems are not as popular these days within  
the Python community as the "controller-oriented" frameworks.   
"controller-oriented" frameworks offer a much better way to build not  
just a "website" but a full web-enabled application.

it should be noted that the most "robust, high capacity, high user  
systems" out there are more often than not built either on Java  
servlets or proprietary C-based frameworks, just read the job ads for  
people building banking, commercial airline reservation, and  
goverment websites.  so it should not be considered that "PHP's page- 
oriented model" is the most "robust"...its not.  it scales pretty  
poorly for data/transactional intensive applications in particular,  
doesnt have much of a solution for clustering, sophisticated  
transaction models, etc.  plus as a language PHP is terribly terribly  
broken, and their security people seem to keep quitting the project  
in disgust.

frameworks like pylons, turbogears, django, cherryPy, etc. are not  
"page-oriented", they are "controller-oriented".  these have a closer  
analogy to Java servlets or Ruby on Rails controllers, and have a  
series of components that are separate, the central one being the  
"controller", and another important one being templating.  there are  
then at least a dozen template languages available for Python and  
people typically pick one they like.

in reality, even systems like PHP have a form of "controller"  
present, its just implicitly available as a controller that is  
hardwired to a particular notion a request cycle (that is, get a URL,  
pass control directly to a template), and of resolving URLs to files  
(the file scheme in the URL maps directly to a local filesystem  
scheme).  these days its very popular in web development to demand  
more functionality than that (as the popularity of Rails attests);  
hence the greater complexity.

On Mar 5, 2007, at 10:14 PM, [EMAIL PROTECTED] wrote:

> It seems that the most important concept in Python web development  
> is the least explained and hardest to understand (which makes it  
> very hard for anyone that wants to learn Python for web  
> development).  I wonder if you all might be able to help me  
> understand it.
> I posted a thread about it here:
> http://python-forum.org/py/viewtopic.php?t=3310
> I'll also include the post here:
> I have looked at a lot of stuff related to web programming in  
> Python, including the various frameworks like Pylons. However, I am  
> still completely lost as to how the whole website development on  
> Python works.
>
> With PHP, the concept is relatively simple to understand:
> 1. You install a web server like Apache.
> 2. You install PHP, which basically outputs text files that are  
> then served to the web by Apache.
> 3. The logic of how they interact is rather simple too:
> 3a. Apache sends the GET or POST request to the PHP file and PHP  
> has built-in methods for reading the GET or POST data.
> 3b. PHP then outputs text, which Apache serves up to the web for  
> all to see.
>
> Simple, and easy 'eh? But, I simply do not understand the concept  
> of how Python web development works.
>
> *. Reading around, I see that there are different methods for  
> handling URL requests, which implies that things work at a much  
> lower level (and in a much more complex way) than what I understand.
> *. There are many web development frameworks, but I am simply not  
> sure what they are for. In PHP, you can use the frameworks to more  
> easily code PHP files to put on your server; however, in the end  
> the PHP concept is still the basic and simple one described  
> earlier. On the other hand, with the Python frameworks it almost  
> seems like they do more, as some include a web server and stuff  
> like ways to handle URLs. I am not sure what to make of this or  
> what it all means.
>
> *. As I understand it, Python is not anything like PHP in that it  
> does not embed code into HTML, but works differently? How do you  
> code html pages then? Or do you code things differently? Do you  
> need to use some kind of template language? If so, how do you know  
> which one to pick? How do you use them and how do they fit into  
> what appears to be an increasingly complex design for website  
> programming?
>
> Taking a look at Pylons, I see several things:
> "Models" - referring to databases
> "Templating"
> "AJAX"
> "Request Dispatching"
>
> Ajax is not key to web programming (since it's client side  
> javascript), so I don't even have to ask about that. You can just  
> as easily download and install ajax libraries on your own or use  
> them on static html pages.
> Models (in reference to databases) appears to just refer to the  
> various database abstraction libraries. Again, this is not part of  
> the basic concept of web development, though it is very important  
> to have when making sites. From SQLAlchemy's site, actually using  
> such an abstraction library to access databases appears very easy  
> and straightforward. It appears that you can do this in any Python  
> app, and is thus not unique to web development.
>
> So, we are left with:
> "Templating"
> "Request Dispatching"
> and I would like to add:
> Server
>
> What is "Templating"?
> What is "Request Dispatching"?
> How do these fit into the simple web development design I gave  
> earlier? Are they key components, or optional stuff like Ajax and  
> DB Abstraction?
>
> It seems the key parts that I am trying to understand are least  
> explained? Basically it is this?
> *. How do you setup a webserver for Python web development (I am  
> talking about a robust, high capacity, high user system like the  
> Apache/PHP setup I described earlier -- in other words, one that  
> you would use for a high profile website; not some test server)?
> *. How do you create webpages in Python -- specifically the  
> processing of GET,POST,COOKIES, and then the displaying of HTML,  
> XML, etc...? Do you have to use the CGI method, as opposed to PHP's  
> mixing of HTML and code? Are there are streamlined and better ways  
> of doing this? I forsee Python's use of whitespace to be a problem  
> in PHP like coding. Does creating webpages mean I have to use some  
> kind of library to make it easier. If so, what are these libraries?  
> Are they the templating languages? How do you know which one to  
> choose?
>
> * What is this "Request Dispatching" that I hear about? Does Python  
> web development not handle file names in the same way as PHP or  
> Perl? Can you explain?
>
> _______________________________________________
> Paste-users mailing list
> [email protected]
> http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users


_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to