[mod_python] How do I find the document root?

Dave Cole djc at object-craft.com.au
Thu Dec 7 10:01:57 EST 2000


>>>>> "Gregory" == Gregory Trubetskoy <grisha at modpython.org> writes:

Gregory> This may be a roundabout way of doing this, but you could use
Gregory> the req.server.defn_name and req.server.defn_line_number to
Gregory> read the DocumentRoot from the config file.

Gregory> I haven't had my coffee yet, so I hope the above makes sense.

Yup, that makes sense.  It is not what I would call an ideal solution
though :-).

The other thing that I was trying to work out was how to direct all
requests below a certain directory to a single python program.  When
the request is referring to a directory, mod_dir/mod_autoindex kick
in.  I have come up with some mod_rewrite directives, but again, I
wish there were another way to just disable those modules below that
directory.

RewriteEngine on
RewriteRule ^$ main
RewriteRule .*/$ main
SetHandler python-program
PythonHandler main

- Dave

-- 
http://www.object-craft.com.au




More information about the Mod_python mailing list