Volodya
volodya at real.samuraj.org
Thu May 20 12:07:21 EDT 2004
On Wed, May 19, 2004 at 03:57:17PM -0400, Jorey Bump wrote: > David Geller wrote: > > >I have had the same experience as Terry. > > > >However, I just tried something and it worked! > > > > <Directory /www/docroot> > > PythonInterpreter myapp2 > > PythonPath "blahblabh > > SetHandler python-program > > PythonHandler mod_python.publisher > > PythonDebug On > > </Directory> > > > >i.e., use "SetHander python-program" with no following argument ".py", > >followed by "PythonHandler with arg of mod_python.publisher" > > Hmmm, then *every* file needs to be a python program. You can't mix > html, php and image files. You might as well just run python apps from > cgi-bin. > > This is an interesting problem. With these directives in httpd.conf: > > <Directory /var/www/documentroot> > AddHandler python-program .py > PythonHandler mod_python.publisher > PythonDebug On > </Directory> > > And assuming my app is test.py: > > def hello(req): > x = "Hello, world!" > return x > > I can access it on my Debian Woody production server (apache 1.3.26, > mod_python 2.7.8) like this : > > http://www.example.com/test/hello > > But on my Red Hat 9 server (apache 2.0.40, and mod_python 3.0.1-4), I > need the extension: > > http://www.example.com/test.py/hello > > If I change the AddHandler directive to: > > SetHandler python-program > > I MUST access it without the extension, but all files in the directory > are treated as python programs. This seems less flexible to me. I can't > simply turn on mod_python for the entire site, as I do now. Is this the > result of a change in apache or mod_python? > You can "turn off" mod_python for specific files or locations by using: SetHandler default If you prefer httpd.conf use <Location> directive: <Location /python/css > SetHandler default </Location> or <Files> directive: # text files <Files *.txt> SetHandler default </Files> # gfx files <Files ~ "\.(gif|jpe?g|png)$"> SetHandler default </Files> Hope this helps.
|