[mod_python] httpd/unix-directory instead of index page

Ravi Shekhar ravishekhar at gmail.com
Mon Jun 21 14:46:46 EDT 2004


Hi everyone,

I've set up a handler() function in index.py that looks at the req.uri
parameter and decides what to serve based on that. My problem is that
when I visit http://localhost ,I get a mime type error that I don't
know how to fix. It says "You have chosen to open http://localhost/
which is a: httpd/unix-directory" and pops up the save file dialog.
However, when I visit http://localhost/index.py, everything works as
it should. It's probably something obvious, but I'm not sure what I'm
doing wrong.

This is the relavent block in my httpd.conf

DirectoryIndex index.py index.html
<Directory /var/www/html>
        SetHandler python-program
        PythonAuthenHandler authenticator
        PythonHandler index
        PythonDebug On
        AuthType Basic
        AuthName "Restricted"
        Require valid-user
</Directory>

And my handler function (for now) is quite simple.

def handler(req):
        req.write(str(req.unparsed_uri))
        return apache.OK

I'm running Linux 2.6.6 on Fedora Core 2. Thanks, I really appreciate the help.

Ravi


More information about the Mod_python mailing list