En Sun, 25 Oct 2009 17:47:43 -0300, Peng Yu <pengyu...@gmail.com> escribió:

Although, python can be used to provide web service. The following
webpage also mentioned, "Apache the best and most widely used web
server on the Internet today, check it out. If you want to run your
own web server this is the one to get, you can get binaries for both
Windows and Unix. You can download the entire sourcecode if you want
to check how it was made." Therefore, it would be better to use Apache
rather than python to provide web service, right?

Note that web server != web service.

Apache is a "web server"; it handles HTTP requests to serve web pages, typically HTML documents, images, videos, etc. Usually those requests come from a human browsing the web. Apache is highly optimized to serve "static" documents (those that are already prebuilt, and aren't dependent on specific details of the current request, e.g. a photo). "dynamic" documents (e.g. your bank account statement) have to be generated for each specific request - there is a program behind those dynamic documents, and that program may be written in Python (or Perl, or PHP, or whatever). That is, Python is used to build dynamic content -- pages that cannot be prebuilt.

Although you can write a web server in Python itself, and it works fine for low-volume sites, it cannot compete (in speed, number of concurrent transactions, and other features) with Apache or lighttpd.

A "web service" is a program that exposes some sort of API that can be accessed thru a web interfase, mostly intended to be used by other programs, not humans. Web services usually are built on top of HTTP as the transport layer, so they run behind Apache or other web server. Python is perfectly adequate to write web services.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to