On Thu, Nov 4, 2010 at 3:12 PM, Jirka Vejrazka <jirka.vejra...@gmail.com>wrote:

> > How can I get hold of the connection used to create the object, from
> within
> > each thread, so that each thread closes the connection that it has just
> > used? Alternatively, how can I get a list of all the open connections
> that
> > Django is using at any one time. I am using the "standard" model query
> API,
> > and not executing custom SQL directly.
>
>   Hi Joseph,
>
>  I use simple:
>
> >>> from django.db import connection
> >>> connection.close()
>
>  Please note that this is pre-multidb support, so you'll probably
> have to use the connections dictionary - see multi-db documentation
> for details.
>
>
Thanks a lot Jirka. Calling this from inside each thread seems to have done
it for me:

>>> from django.db import connections
>>> for connection in connections.all(): connection.close()

Regards,

Joseph.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to