Re: Single-threaded WSGIResource

[email protected]
Newsgroups gmane.comp.python.twisted.web
Message-ID <20100202221307.26099.1246970293.divmod.xquotient.88@localhost.localdomain>
On 09:58 pm, [email protected] wrote:
>Hi,
>
>I'm playing with Django (1.1.1) under Twisted Web (9.0.0) through the
>WSGI interface. When using my web app under the test server with
>sqlite3 as the DBMS, I'm having troubles since in-memory sqlite3 DBs
>can't be shared among threads.
>
>The solution I came up with was to run the WSGIResource in the main
>thread. In order to do so, I subclassed the WSGIResource as follows:

Can you use a thread-local SQLite3 connection, or is that logic buried 
too deeply in some other code?

Another option (I think - untested) would be to give WSGIResource a 
different implementation of the thread pool interface:

class NotThreadPool:
    def callInThread(self, f, *a, **kw):
        f(*a, **kw)

Jean-Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.