On Wed, Jun 13, 2012 at 7:49 PM, Gilles <nos...@nospam.com> wrote: > On Wed, 13 Jun 2012 19:41:41 +1000, Chris Angelico <ros...@gmail.com> > wrote: >>For high-availability servers, I can't speak for Python, as I've never >>done that there; but it seems likely that there's good facilities. My >>personal preference is Pike, but that's off-topic for this list. :) >>But the simple answer for simple tasks is: Don't bother with >>frameworks, run an HTTP server. > > Thanks. What do you mean with "Don't bother with frameworks, run an > HTTP server"? Subclassing BaseHTTPServer?
Apache is a web server, by which one technically means an HTTP server. HTTP is the protocol (HyperText Transfer Protocol) by which web servers and browsers communicate. Basically, you listen on a TCP/IP socket, usually port 80, and respond to requests. One way to achieve that is to let somebody else do the whole listen-on-80 bit and then call upon you to generate a block of text. That's what happens with Apache and PHP - your PHP script doesn't think about sockets, listening, and so on, it just gets a request and deals with it. The other obvious option is to write your own code using the basic BSD socket functions, and do the whole job yourself. That's a good thing to do once in a while, just to get to know how it all fits together, but unless you're working in C, there's no particular reason to go to that much hassle. Half way in between is where BaseHTTPServer puts you. All the grunt-work is done for you, but your program is still 100% in control. You call on somebody else's code (the Python standard library) to handle all the socket basics, and your code gets called to generate a page. But you can do more than just generate a page, if you so desire. Most high level languages probably have some sort of HTTP server available. Some make it trivially easy to plug some code in and start serving. Python is advertised as "batteries included", and one of its packets of batteries is a fairly full-featured set of internet protocol handlers. ChrisA -- http://mail.python.org/mailman/listinfo/python-list