[mod_python] Directory or Location?

Timothy M. Brauch tbrauch at mindless.com
Thu Jun 12 01:50:36 EST 2003


Okay, I just want to go over a small frustration I just had and spent a few
hours trouble shooting.  In the tutorial,
http://www.modpython.org/live/current/doc-html/inst-testing.html, to run the
mptest script you must type:

<Directory /some/directory/htdocs/test>
  AddHandler python-program .py
  PythonHandler mptest
  PythonDebug On
</Directory>

in the python.conf file.  However, in the default python.conf file that was
installed with the mod_python 3.0.0-10 rpm, the examples say

# This will cause files beneath /var/www/html with the extension .spam
# to be handled by the Python script /var/www/html/eggs.py
#
#<Directory /var/www/html>
#    AddHandler python-program .spam
#    PythonHandler eggs
#</Directory>
...
# This will cause all requests to the /python heirachy **<--note typo** of
your
# webserver to be handled by mod_python's Publisher handler
# (see http://localhost/manual/mod/mod_python/hand-pub.html)
#
#<Location /python>
#    SetHandler python-program
#    PythonHandler mod_python.publisher
#</Location>


What is the difference between using "Location" and "Directory"?  When do I
use each one?

As I found out, there is a difference and if you use "Location" where you
should use "Directory".  You get a 500 Internal Server Error that I never
quite understood and spent some time trying to fix.  There doesn't seem to
be anything in the documentation I've read to describe the difference

 - Tim



More information about the Mod_python mailing list