[mod_python] mod_python only returns 404 error's

Cryptronic mail at cryptronic.de
Sun Nov 5 15:57:37 EST 2006


Hi

thank you very much for this quick help.
All works fine. The problem was, that this was not for me but for a customer 
and I haven't even tried using python for myself so I doens't know how to 
create a testscript.

best regards

Oliver Werner

Am Sonntag, 5. November 2006 21:26 schrieben Sie:
> Cryptronic wrote:
> > Hi all,
> >
> > i tried to use mod_python, installation from .deb works fine.
> >
> > I'm running following configuration:
> > Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4c0
> >
> > then i tried to following skript:
> >
> >  from mod_python import apache
> >
> >  def handler(req):
> >      req.content_type = "text/plain"
> >      req.write("Hello World! Blarg!")
> >      return apache.OK
> >
> >
> > with rights: 755 owned by the suexec user
> >
> > with the following vhost config:
> >
> >       AddHandler python-program .py
> >       PythonHandler mod_python.publisher
> >       PythonDebug On
> >
> > when i open the url in browser errlog shows me:
> > [notice] mod_python: (Re)importing module 'mod_python.publisher'
> > [notice] [client] Publisher loading page /var/www/test/test2.py
> >
> > But i got in the browser only a 404 page -  no error's  in log - nothing
> > :(
>
> Your test2.py file is something you might use if you were writing your
> own handler. Publisher is a little different. It first looks for the
> index method. Try this (Notice :
>
> def index(req):
>      req.content_type = "text/plain"
>      return "Hello World! Blarg!"
>
>
> You can also do something like this:
>
> def index(req):
>      req.content_type = "text/plain"
>      req.write("Hello World! Blarg!")
>
> Notice that we are *not* returning apache.OK. Publisher looks after this
> for you.
>
> You can also publish other methods in your file:
>
> def foo(req):
>      return "This is foo"
>
> and fetch it with http://localhost/test/test2.py/foo
>
> Jim

-- 
Mit freundlichen Grüßen

O. Werner



More information about the Mod_python mailing list