Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

17 September 2008

apache2 and mod_python configuration

The useful code snipet that can be included in the .htaccess file or in the apache conf files, so that .py files and other files can be placed in the same directory.

<Directory /var/www/py>
SetHandler mod_python

PythonHandler mod_python.publisher

PythonDebug On
<Files ~ "\.(gif|html|jpg|png)$">

SetHandler default-handler
</Files>

</Directory>


Links
http://webpython.codepoint.net/mod_python_publisher_apache_configuration
http://www.phpbb.com/community/viewtopic.php?f=46&t=1139555
http://httpd.apache.org/docs/2.0/mod/core.html#sethandler

28 May 2008

Getting mod_python.publisher work via .htaccess

Being able to use a ".htaccess" file, was however dependent on your directory at least allowing overriding of "FileInfo" aspects of the configuration. If however an Apache administrator will not allow this, you will not have any choice but to have the ability to use mod_python in a directory enabled in the global configuration."
http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking

So, add AT LEAST the following lines to your httpd.conf

AllowOverride FileInfo

And to your .htaccess:

SetHandler mod_python

PythonHandler mod_python.publisher


This was tested in the following environment:
Apache/2.2.3 (testvw) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch7.56.200712100724 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at 10.200.20.10 Port 80

Some useful links:
http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
http://httpd.apache.org/docs/1.3/mod/mod_mime.html#sethandler
http://missysadmin.com/2007/11/21/installing-mod_python/
http://www.dscpl.com.au/wiki/ModPython/Articles/SetHandlerVersusAddHandler
http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking

Some useful commands:
tail -f /var/log/apache2/error.log