Nicolas Lehuen
nicolas.lehuen at gmail.com
Fri Feb 25 07:58:34 EST 2005
On Fri, 25 Feb 2005 14:36:10 +0000 (GMT), lafras at sun.ac.za <lafras at sun.ac.za> wrote: > hi, > > i have the following in my apache conf file, > > <Directory "path/to/my/directory"> > SetHandler mod_python > PythonHandler mod_python.publisher > PythonDebug On > </Directory> > > I get some odd behaviour though, > > when opening up a *.py script in my browser, everything works fine and > apache displays what it should, however when i try open a *.html file, i > get this error, > > Mod_python error: "PythonHandler mod_python.publisher" > > Traceback (most recent call last): > > File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, > in HandlerDispatch > result = object(req) > > File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line > 98, in handler > path=[path]) > > File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 454, > in import_module > f, p, d = imp.find_module(parts[i], path) > > ImportError: No module named XXX > > where XXX is a file XXX.html i'm trying to open. > > could someone please point me in the right direction, > thanks in advance, > > lafras Hi, If you use the SetHandler directive, each and every request is handled by mod_python, which then uses mod_python.publisher to publish something according to the request. So with the setup you describe, even a request for an html page is handled by the publisher, which does not find anything to do with the URL it is provided. A simple solution is simply to tell Apache to use mod_python only for .py files ; for this you use the AddHandler directive instead of the SetHandler one : AddHandler mod_python .py instead of : SetHandler mod_python Regards, Nicolas
|