Re: CP3.0beta & mod_python -> NameError: name '_cprequest' is not defined

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: CP3.0beta & mod_python -> NameError: name '_cprequest' is not defined

Robert Brewer

Dan Kvasnicka wrote:
> So, I've got it working finally. First thing I had to do was importing
> _cprequest in __init__, so maybe someone who has the right to commit to
> cherrypy sources could fix that there.

Funky. Fixed in

> I also changed the PythonOption the way you suggested and it works.
> However, in my case I HAVE TO provide a funcion after :: on that line.
> If I don't provide :: and write only module name, modpython_gateway
> dies on splitting the arg, because he looks for '::'. When I keep ::
> and write no func name, it dies on a quite peculiar error:
> AttributeError: module '/var/www/myapp2/' contains no ''
> Dunno what that means exactly...

I did that for symmetry with wsgi.cleanup, which only makes sense with
functions, and to make it easy to run the startup func once (since that
PythonOption is checked for every request). I'll see if I can't make it
work with modules as well as funcs.

> Next thing is that the 'startapp' function has to have an argument.
> What exactly is it, the request?

Yup. The mod_python Request object, that is.

> Next thing, you have to mount HelloWorld() to '/myapp'. When you mount
> it to '/' and point a browser to http://localhost/myapp, you get 404.

Are you talking about _cpmodpy? Apache does odd things with SCRIPT_NAME
when using dynamic handlers like mod_python, usually setting it to
path.split("/")[:-1]. Mounting your app at '/myapp' tells _cpmodpy
which app should respond to which URL's.

If you're talking about mopython_gateway instead, are you using
"PythonOption SCRIPT_NAME /myapp"?

> And the last thing, with _cpmodpy I still get a blank screen :(

A ticket with a minimal test case would be greatly appreciated on that
issue. ;)

Robert Brewer
System Architect
Amor Ministries
[hidden email]

You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at