[Twisted-Python] Sharing a database connection in web server

Matt Haggard haggardii at gmail.com
Thu Dec 19 13:34:10 MST 2013


Matthew,

I've found klein to be really useful for this.  Especially the ability
to have non-global state:
https://github.com/twisted/klein#non-global-state

Matt

On Thu, Dec 19, 2013 at 1:05 PM, Matthew Wollenweber <mwollenw at gwu.edu> wrote:
> Hello,
>
> Could someone please let me know the preferred method for sharing a database
> connection within a twisted.web.server instance? I've found that adbapi is
> the preferred method to avoid blocking when making database calls, however
> I'm still struggling how to share a database connection within the Site.
>
> I would like to connect to the database when the server/site is executed and
> make that connection accessible to pages/classes within the Site. Could
> someone offer some advice?
>
>
> Thanks for the help.
>
> --
> Matthew Wollenweber
> Principal Security Engineer
> DIT/Information Security Office
> The George Washington University
>
> mwollenw at gwu.edu
>
>
>
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



More information about the Twisted-Python mailing list