Also explain why you aren't following guidelines in:
http://code.google.com/p/modwsgi/wiki/IntegrationWithCherryPy
Namely, should you run in 'embedded' mode and not 'production'. There
are important differences with how CherryPy sets things up and not
running in 'embedded' mode may cause problems. Running in 'production'
doesn't mean it will run faster, 'embedded' mode is the correct mode
for mod_python and mod_wsgi.
Also get rid of the whole CherryPy config bit as 'embedded' mode does
most of that. Also can you not log to an alternate file and instead
let any output go through to Apache error log.
In other words, follow the recipe in the documentation instead and
then indicate what issues there are.
Graham
WSGIScriptAliasMatch .* /home/sombshet/cgi-bin/run_wsgi.wsgi
Use:
WSGIScriptAlias / /home/sombshet/cgi-bin/run_wsgi.wsgi
I'd have to check, but that in itself may be the problem as what you
are using may be resulting an a separate instance of your application
for every URL. ie., separate interpreter instance for every URL.
Ensure you enable:
LogLevel info
The Apache error log will then show you lots of information about when
sub interpreters are being created. If you keep seeing new ones
created that is the problem.
Graham
The reason is that by default mod_wsgi will create sub interpreters
for each application. What is an application is determined by value of
SCRIPT_NAME. Problem is that for .* on pattern side like that,
SCRIPT_NAME is set to the complete URL. Thus mod_wsgi thinks that
every URL is a different application and creates a different sub
interpreter for it.
I am though surprised though that CherryPy even worked unless it
doesn't actually honour SCRIPT_NAME as mount point correctly and
instead falls back to REQUEST_URI instead anyway and relies on its own
internally configured base url parameter.
Maybe, mod_wsgi should use (mod_wsgi.application_group, script_filename)
as the key for the mapping, instead of script_name. That way, multiple,
disjoint URLs can get mapped to the same application.
Otherwise, is WSGIScriptAliasMatch really needed? I admit that I use it
because I have dozens of testcase WSGI applications in a directory. But,
that is hardly typical usage. I wouldn't be sad if it was removed.
It seems like we should be able to replace ScriptAliasMatch with
WSGIScriptAliasMatch to switch from CGI to mod_wsgi. However, that is
almost always going to be a very bad idea, like in this example.
WSGIScriptAlias should be used in almost every case.
- Brian
Actually that is the case. Running inside mod_python or mod_wsgi is
exactly what is meant by embedding it in another deployment stack. :-)
Graham
I'm not sure what you are trying to accomplish with that kind of
mapping, so I can only speculate. If you don't have many applications,
it is easy to just use WSGIScriptAlias for each one. If you do have a
lot of applications, then the above mapping will likely waste tons of
memory, so it would be better to combine the apps together into a bigger
one.
I'd also use mod_rewrite to get rid of the "/servlet" suffix on all your
URLs, as it seems to be getting in the way.
Regards,
Brian