Mod_python
Jacek Trzmiel
sc0rp at hot.pl
Thu Mar 25 02:17:50 EST 2004
Amy G wrote:
> So I can now restart apache and everything seems to work. Except my python
> files still show up as text in the browser window.
>
> I am using Apache 1.3.7.
> I downloaded both mod_pyton-2.7.10 and 2.7.9.
Below is configuraton that does work with Apache 2.0.49 and mod_python
3.0.3. Maybe it will work with older version as well.
Make sure that similar entires are in http.conf (paths on your system
may be different):
-----
LoadModule python_module libexec/apache2/mod_python.so
DocumentRoot "/usr/local/www/data"
<Directory "/usr/local/www/data">
AllowOverride None
Order allow,deny
Allow from all
SetHandler python-program
PythonHandler Handlers
PythonDebug On
</Directory>
-----
Place your script as:
/usr/local/www/data/Handlers.py
Something like this should work:
from mod_python import apache
def handler(req):
req.content_type = "text/plain"
req.write("Hello World!")
return apache.OK
Best regards,
Jacek.
More information about the Python-list
mailing list