Terry MacDonald
terry.macdonald at dsl.pipex.com
Thu May 20 13:56:55 EDT 2004
On Thu, 2004-05-20 at 12:27, Volodya wrote: > On Thu, May 20, 2004 at 11:54:20AM +0100, Terry MacDonald wrote: > > If I do this in http.conf > > > > PythonDebug on > > > > <Location /test> > > SetHandler mod_python > > PythonHandler mod_python.publisher > > </Location> > > > > If in the test directory I have a file index.py containing a function > > index() and I direct my browser to http://localhost/test I get this: > > > > Mod_python error: "PythonHandler mod_python.publisher" > > > > Traceback (most recent call last): > > > > File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 299, in HandlerDispatch > > result = object(req) > > > > File "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 98, in handler > > path=[path]) > > > > File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 454, in import_module > > f, p, d = imp.find_module(parts[i], path) > > > > ImportError: No module named test > > > > The publisher is treating the '/test' part of the URI as a module! > > > > So what am I doing wrong? > > I've tried the same, and everything works fine. > > Portion of my httpd.conf (Apache 2.0.48): > > <VirtualHost 192.168.0.201:80> > ServerName lan.MYDOMAIN.TLD > ServerAdmin postmaster at MYDOMAIN.TLD > DocumentRoot /home/volodya/lan/data > ScriptAlias /cgi-bin/ /home/volodya/lan/cgi-bin/ > <Directory /home/volodya/lan/data/> > AllowOverride All > Order allow,deny > Allow from all > </Directory> > <Directory /home/volodya/lan/cgi-bin/> > AllowOverride All > Options ExecCGI > Order allow,deny > Allow from all > </Directory> > # ------------------------------------------------- > <Location /test> > SetHandler mod_python > PythonHandler mod_python.publisher > </Location> > # ------------------------------------------------- > ErrorLog /home/volodya/lan/log/error-lan.log > CustomLog /home/volodya/lan/log/access-lan.log common > </VirtualHost> > > > index.py , placed into /home/volodya/lan/data/test directory: > > # ------------------------------ > def index(req): > return "hello" > > def func(req, name="world"): > return "Hello, %s !" % name > # ------------------------------ > > > http://lan.MYDOMAIN.TLD/test/ > Output: hello > > http://lan.MYDOMAIN.TLD/test/func?name=Volodya > output: Hello, Volodya ! > > > Env: Apache 2.0.48 (prefork mpm), mod_python 3.1.3, Python 2.3.3, FreeBSD 4.9 > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python If I use Directory instead of Location it works except my images and css files are not loaded, those files are in subdirectories of /test (/test/images and /test/css) Other info: My Document root is /var/ww/html however my application resides in /var/www/python/test; is this significant? FC1, apache 2.0.48, mod_python 3.1.3 -- Terry Registered Linux User # 311806 www.taumu.com
|