based on advice on the group long ago i am using a pattern like this: in db.py:
current.myapp = Storage() current.myapp.db = db #after db is inited then in my module refrencing db as: current.myapp.db i'm using this on GAE and it has been working like a champ. the key is to add the just defined version of the db variable to current on each request, and not cache it as a static variable. remember that db changes on each request (new connection from the pool, different default and requests for table fields etc), so you can't keep db a static module variable or a static global variable and have it work for more then 1 request.

