<IfDefine HAVE_PYTHON> <IfModule !mod_python.c> LoadModule python_module extramodules/mod_python.so </IfModule> </IfDefine> # NOTE: # If you get something like this in the log: # [error] (28)No space left on device: mod_python: Failed to create global mutex 145 of 256 # increase the values like this: # echo "300 90000 100 150" > /proc/sys/kernel/sem <IfModule mod_python.c> PythonOption mod_python.mutex_directory "/var/cache/httpd/mod_python" # # Mod_python is a module that embeds the Python language interpreter # within the server, allowing Apache handlers to be written in Python. # # This will cause files beneath /var/www/html with the extension .spam # to be handled by the Python script /var/www/html/eggs.py # #<Directory /var/www/html> # <IfModule mod_mime.c> # AddHandler python-program .spam # </IfModule> # PythonHandler eggs #</Directory> # This will cause all requests to the /python hierarchy of your # webserver to be handled by the python script /path/to/myhandler.py # #<Location /python> # SetHandler python-program # PythonPath "sys.path + ['/path/to']" # PythonHandler myhandler #</Location> # This will cause all requests to the /python hierarchy of your # webserver to be handled by mod_python's Publisher handler # (see http://localhost/manual/mod/mod_python/hand-pub.html) # #<Location /python> # SetHandler python-program # PythonHandler mod_python.publisher #</Location> # This will cause all requests to *.psp under the /python hierarchy of your # webserver to be handled by mod_python's PSP handler # (see http://localhost/manual/mod/mod_python/hand-psp.html) # Another nice introduction can be found on # http://www.onlamp.com/pub/a/python/2004/02/26/python_server_pages.html # #<Location /python> # AddHandler mod_python .psp # PythonHandler mod_python.psp # # # If you need to debug, uncomment the following line # #PythonDebug On # # If you wan to see the generated python source, enable debug # # and uncomment the following line. # #AddHandler mod_python .psp_ #</Location> <Location /mod_python-test> SetHandler mod_python PythonInterpreter main_interpreter PythonHandler mod_python.testhandler Order deny,allow Deny from all Allow from 127.0.0.1 ErrorDocument 403 "Access denied per /etc/httpd/modules.d/16_mod_python.conf" </Location> </IfModule>