[mod_python] Re: Mod_python.publisher behavior - sending .py file tobrowser not processing it in pyton

Daniel Nogradi nogradi at gmail.com
Thu May 4 06:17:38 EDT 2006


> > Just getting started with modpython. And i am not sure if I understand
> > the
> > documentation, specifically section 6.1.2 Publishing algorithm so I hope
> > someone can set me straight.
> >
> > My setup is on a laptop
> > Apache/2.0.54 (Win32) mod_python/3.2.8 Python/2.4.1 Server
> >
> >
> > Using mod_python.publisher with the following setup in my http.conf file;
> > <Directory "C:\Program Files\Apache Group\Apache2\htdocs\app/">
> >     SetHandler mod_python
> >     AddHandler mod_python .py
> >     AddHandler mod_python .pyw
> >     AddHandler mod_python .pyc
> >     PythonHandler mod_python.publisher
> >     PythonDebug On
> > </Directory>
>
> Running out the door, so can't explain in detail. But you should not
> be setting both SetHandler and AddHandler. Just use SetHandler and
> see what happens.
>

As Graham pointed out SetHandler and AddHandler should not be used at
the same time. "SetHandler mod_python" causes all files to be served
by mod_python and when you refer to them in your browser you don't
need to specify any extension such as .py and "AddHandler mod_python
.py" causes all files ending in .py to be served by mod_python but in
this case when referring to a file in your browser you should add the
.py extension. So if you have

<Directory '/your_document_root/whatever'>
    SetHandler mod_python
    PythonHandler mod_python.publisher
</Directory>

and you have a file /whatever/foo.py with a function bar( ) then in
your browser you would type http://yourserver/whatever/foo/bar,
whereas with

<Directory '/your_document_root/whatever'>
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
</Directory>

you would need http://yourserver/whatever/foo.py/bar

So it's really up to you which behaviour you like, you want *all*
files to be served by mod_python or only those that have a specific
extension and then you set either AddHandler or SetHandler. But not
both :) And in any case, you certainly don't want your .pyc files to
be served at all, so you should probably remove "AddHandler mod_python
.pyc".

HTH :)



More information about the Mod_python mailing list