| PyApache Home | PyApache Distribution |
|
PyApache module |
The PyApache module embeds the Python interpreter into the Apache server enabling the execution of Python code directly, with a consequent speed-up in server response time. Python scripts executed by an embedded interpreter will run much faster than ordinary scripts since the interpreter need not be launched for every script, requiring only a warm restart. Runs with Python1.X/2.X under Apache 1.3.X/2.0 (configurable).
As with most Apache modules these days, the server does not need to be patched in order to integrate this module; a Makefile script runs Apache's "apxs" utility which compiles and installs PyApache.
"How do I use it?"
A minimalist example:
print "Content-type: text/plain\r\n\r\n" print "Hello, world"
(Note the absence of the usual leading "#!/usr/bin/python". Python isn't running as a cgi-bin script, so a hashbang line isn't necessary.)
"What's the difference between PyApache and mod_python?"
PyApache embeds a Python interpreter in Apache and that's it. There are no special interface classes, no hooks into the request structure, just native execution of Python code. You can import any of the standard Python library packages or add your own.
[GJH: Friday 18th. March 2004]