/index.html wierdness was: RE: [mod_python] How do I serve up .html files?

Michael C. Neel neel at mediapulse.com
Wed Aug 27 15:25:52 EST 2003

I've noticed this /index.html wierdness as well.  It seems (in 2.7.8 at
least) that unless there is a file in the document root called
index.html, mod_python is not called not matter if it's set in a
Location or Directory section.  I tested this with a simple:

def handler(req):
	assert 0, req.uri

With the conf of:

<Location />
        SetHandler python-program
        PythonHandler www

and later with

<Directory /home/httpd/webroot>
        SetHandler python-program
        PythonHandler www

And would always get a directory listing (or an error lising not allowed
page) for site.com/, but every other url tried would throw the assert
execption.  If I create an empty index.html file in the document root,
apache does its internal redirect and my assert get's picked up on the
redirect.  This is only needed for the root though, I do not need to
create the sub dirs or index.html pages in them.


> -----Original Message-----
> From: Stian Søiland [mailto:stian at soiland.no] 
> Sent: Wednesday, August 27, 2003 2:39 PM
> To: mod_python at modpython.org
> Subject: Re: [mod_python] How do I serve up .html files?
> Remember that even though you SetHandler to something, 
> you'll also need to set DirectoryIndex to some EXISTING FILE. 
> I did this
> error as I included all python code in the pythonpath and had no files
> in the actual path. I used SetHandler nav.web.devBrowser.dispatcher
> in .htaccess for a blank directory.
> Now, DirectoryIndex could not simply be index.html, as there were no
> file index.html. I created a file "index" in the otherwise blank
> directory, set DirectoryIndex to "index", and everything worked.
> If the file is removed, the blank directory listing is presented, but
> other urls within the directory works.
> (the handler receives the request as being to /index, and the file is
> never actually read from disk due to SetHandler intercepting)
> Now, some gurus might have a suggestion about getting rid of 
> that empty
> file. If so, please let me know! =)

More information about the Mod_python mailing list