[Twisted-Python] Connection Pools for websites...

Ken Kennedy kkennedy at abelard.kenzoid.com
Sun Oct 20 14:27:52 MDT 2002


Hello all:

OK...it's time for me to start tossing out my stupid questions. *grin*

Even been lurking on the list, trying to grok Twistedness, and waiting
for things to get close to 1.0. I'm really looking forward to it.

My initial goal is to use Twisted for web serving, in the classic
"db-backed website" style. My main question is regarding database
connections. I've read the twisted.enterprise docs (though not all the
code comments yet), but I haven't seen what I'm looking for. If it's
obvious, I apologize...*grin*.

I understand the adbapi.ConnectionPool...but what I want is a way to
share that across multiple (for example) rpy files. Let's say I have a
VERY simple woven-based website. (Example follows:)

I'm using a plain twisted web server

mktap web --path ~/public_html
twistd -f web.tap

with my rpy files in the public_html directory. If I have two files

showStories.rpy

and

submitStories.rpy

I want both files to be able to connect to my db via a connection
pool...but a SHARED one.

So my "dbconn = StoryDatabase(dbpool)" would be using a common dbpool. 

Does this make sense...and if so, how can I do it?

Is this something I can/should be able to set with mktap, or configure
via coil? Or should I connect to another, long-running process via PB
to get database info?

I'm going to carefully review the enterprise code now, so maybe I can
answer my own question. Many thanks...

Ken
 




More information about the Twisted-Python mailing list