I'm trying to get mod-python to work with apache2 but not having any success. I've followed a few tutorials for getting mod-python working but I can't see what I'm doing wrong.
When I visit http://site.example.com/cgi-bin/test.py I actually get my 404 page! (whereas I get a 403 forbidden if the file really doesn't exist)
Here's my setup:
In /etc/apache2/sites-enabled/ there are configuration files named after each of my domains. In the site.example.com file I've added this to the user directives section:
# Begin user directives <--
<Directory /home/default/site.example.com/user/htdocs/cgi-bin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
# --> End user directives
full file here, which includes the line:
EDIT to add contents of test.py:
#!/usr/bin/python
print "Content-type: text/html"
print
print 'hello world'
#print 1/0
As shown above, I get a 404 /python/test.py was not found on this server
.
But if I uncomment the last line I get:
Mod_python error: "PythonHandler mod_python.publisher"
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
result = object(req)
File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 98, in handler
path=[path])
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 457, in import_module
module = imp.load_module(mname, f, p, d)
File "/home/default/site.example.co.uk/user/htdocs/python/test.py", line 5, in ?
print 1/0
ZeroDivisionError: integer division or modulo by zero
Does this traceback look right? Enabling cgitb has no effect by the way.
Is there any other info I can add to help diagnose this?