I've been running PyLucene within the Pylons framework under mod_wsgi for
almost 2 years without any problems.
I call the initVM within my .wsgi file:
import lucene
from paste.deploy import loadapp
lucene.initVM(classpath=lucene.CLASSPATH, maxheap="512m")
lucene.getVMEnv().attachCurrentThread()
application = loadapp('config:/usr/local/www/myapp/trunk/apache.ini')
And in my base controller I call attachCurrentThread on each request:
def __before__(self):
# Bind to JavaVM
lucene.getVMEnv().attachCurrentThread()
I'm not sure how this compares to how it would be done in Django but it sure is
flawless in my threaded Pylons setup.
TJ