Hi folks - I'm a myghty newbie, so forgive me if my question is naive.
I'm running myghty 1.0.1 on top of python2.4.x from apache 2.0.x
Here's the thing - Myghty (or is it mod_python?) doesn't seem to be
honoring my DirectoryIndex directive. I have a site with several
directories that I would like to default to using index.html if the
file is not specified, and there is no dhandler.
Is there a way to convince Myghty to do such a thing? Thanks in advance.
On 6/2/06, Cole Tuininga <cole.tuininga@...> wrote:
> I'm running myghty 1.0.1 on top of python2.4.x from apache 2.0.x
I'm assuming mod_python is in there someplace (?)
> Here's the thing - Myghty (or is it mod_python?) doesn't seem to be
> honoring my DirectoryIndex directive. I have a site with several
> directories that I would like to default to using index.html if the
> file is not specified, and there is no dhandler.
> Is there a way to convince Myghty to do such a thing? Thanks in advance.
This is really a mod_python thing more than a Myghty issue; or
more precisely, an Apache issue more than either.
DirectoryIndex is a directive which gives the mod_dir Apache
module instructions on what files to red (e.g., index.html) when it
gets called to output content. It is otherwise completely ignored
by the Apache core engine, mod_python, and Myghty.
But the problem you have really comes down to which handler
Apache is choosing to serve the URL. If you're using SetHandler
without any restrictions (such as inside a <Files> section) then
mod_python will always get the request, rather than the built-in
default-handler (which is what then invokes mod_dir or mod_autoindex).
I'm not sure of the best way to do what you want. But perhaps you
can do Apache internal redirects, by using the mod_python
r.internal_redirect() method. Then exclude all files named "index.html"
from being handled by mod_python.
And in your dhandler:
# call normal myghty components, etc.
# no myghty components match, fall back to index.html
dir = os.path.dirname( m.request_path )
r.internal_redirect('%s/index.html' % dir)
You may also be able to play with returning apache.DECLINED
from the mod_python request object, but I suspect there are
too many tricks there to get it to work, especially since you're
inside Myghty which is sitting on top of mod_python.
Note...the above code is totally untested.