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

Reed L. O'Brien reedobrien at acm.org
Mon Jun 21 15:05:36 EDT 2004


Ravi Shekhar wrote:
> 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):
Maybe add req.content_type = "text/plain"  # or text/html #######
>         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

cheers,
reed

-- 



reed
4.6692016090



More information about the Mod_python mailing list