[mod_python] mod_python and apache configuration problem

Kamil Niechajewicz kamil at nvstudio.pl
Thu Jan 15 11:38:23 EST 2004

There was a similar question here some time ago, but the ansewer does
not help with my problem. I have apache virtual host (say,
http://testsite.local and mod_python handler handling _ALL_ 
requests to this url (like http://testsite.local/form, http://testsite.local/
and so on) - just like there was no filesystem.
The document root directory for it is, for example, 
/home/me/public_html/my_app, where handler.py file resides and all
files my application uses (like /img, /lib, /form and so on). Now, I put
this in my httpd.conf section of this <Virtual Host>:

<DocumentRoot /home/me/public_html/my_app>
<Location />
  <SetHandler python-program>
  <PythonHandler handler>
  <PythonPath "sys.path + ['/home/me/public_html/my_app']"

now it seems to work as soon as I don't specify in my URL any directory
that physically exists in my document root (like /form, when I go to
http://testsite.local/form it shows directory index with files - I want
it to process _every_ request by my mod_python handler, and it seems
that Apache just ignores my wish and shows directory content. by the
way, http://testsite.local/form/somerandomstring works fine. I tried
everything, using <Directory> instead of <Location> in every possible
way and still it shows content, not what my handler returns.

Is there any way to prevent Apache from doing that and force it to 
really redirect every request to my python handler? I just want to skip
the phase where URL for this specified Virtual Host is translated to
filesystem, so I could use everything after http://servername/ without
worrying that if it maps to some directory in my application dir, 
apache will display it content, with Python code for example. :-/
I guess the simplest solution will be not creating any directories in my
document root, but I need them to have a nice structure of my app
code, not everything in one dir. This would be stupid. 

With regards,

More information about the Mod_python mailing list