[mod_python] Use mod_python for root/home page requests

Chris Hagner CHagner at fool.com
Tue May 8 22:17:04 EST 2001


Actually, my handler doesn't call scripts (index.py)... instead it call a
Servlet-like object that needs to be in the PYTHONPATH.  This is why I'm
using a Location directive instead of a Directory directive.  I basically
need to handle URLs that map to classes in my path instead of script files
in the file system.

One thing I was considering was dropping a custom PythonTransHandler class
into the document root directory.  Then, if I identify a call for the
homepage, I could do an internal redirect to my servlet (i.e.
http://www.mydummysite.com/contentapp).  

The true hack is to put a META-REFRESH tag in the homepage (index.html) to
http://www.mydummysite.com/contentapp, but then I lose all referrer
information and the ability to do anything based on the original query
string.

Another possibility is mod_rewrite, but I'm not sure that will work.  Still
seems like this should be do-able though, given the number of web pages out
there that need to be fully dynamic.

Thanks for the response though.  Any input/ideas are great to hear.

Chris

-----Original Message-----
From: Ben Leslie [mailto:benno at sesgroup.net]
Sent: Tuesday, May 08, 2001 9:25 PM
To: Chris Hagner
Cc: mod_python at modpython.org
Subject: Re: [mod_python] Use mod_python for root/home page requests


On Tue, 08 May 2001, Chris Hagner wrote:

> I currently have mod_python wired into a location (Specifically <Location
> />) that allows all request coming under this location to be handled by my
> handler.  I also use SetHandler instead of AddHandler so that it doesn't
> even matter what file extension/type is requested.  My goal here is to
have
> an apache instance that has ALL of its requests go through mod_python.
> 
> Now, the strange thing is that this works great for all requests except
for
> the root/home page.  For example,
> 
> http://www.mydummysite.com/blahblah
> 
> This works great... my handler is called and is responsible for
> interpretting 'blahblah'.  However,
> 
> http://www.mydummysite.com/
> 
> This fails to go to the handler and instead looks for the default page
> (index.html) in the DocumentRoot.  Thus, my Location directive doesn't
> appear to be inclusive of the request to the base home URL.
> 
> Has anyone tried this before?  I'd prefer to achieve this without relying
on
> mod_rewrite.



Mmm I think you need to change the "index" dirrective (not sure what its
called,
I'm at uni at the moment, search for index.html). Then you want to add
index.py
to this. That should in theory work.

Cheers,

Benno



More information about the Mod_python mailing list