hi, I found a method to make a persistent connection to database. from django.core import signals from django.db import close_connection signals.request_finished.disconnect(close_connection) <==
I have tested, it work normally! regards, he On Fri, Jul 15, 2011 at 9:44 AM, Kejun He <[email protected]> wrote: > Hi, > I will look the DBUtils imformation first. > > Thank you very much > > regards, > he > > > On Thu, Jul 14, 2011 at 11:58 AM, Jian Chang <[email protected]>wrote: > >> Try DBUtils >> http://www.webwareforpython.org/DBUtils/Docs/UsersGuide.html >> >> 2011/7/13 Kejun He <[email protected]> >> >>> hi, >>> I am sorry. My English is very bad. >>> >>> Yes, i want to make persistent databases connection on each session. >>> >>> >>> and yesterday i try to modify the code on >>> "site-packages\django\db\__init__.py" >>> >>> -------------------------------------------------------------------------------- >>> def close_connection(**kwargs): >>> for conn in connections.all(): >>> conn.close() >>> #signals.request_finished.connect(close_connection) <--- >>> >>> -------------------------------------------------------------------------------- >>> >>> could it work? >>> >>> regards, >>> he >>> >>> >>> >>> >>> On Mon, Jul 11, 2011 at 7:31 PM, Cal Leeming [Simplicity Media Ltd] < >>> [email protected]> wrote: >>> >>>> >>>> >>>> On Mon, Jul 11, 2011 at 4:49 AM, oops <[email protected]> wrote: >>>> >>>>> hi, >>>>> Now, i am doing a django project, and use models to do all operation >>>>> about data in mysql db. >>>>> >>>>> and i think that it would connect to database whenever do some >>>>> operation like 'XXX.objects.all()' , may be it would cast much of >>>>> resource on database connection. So i need a connection never being >>>>> desconnected. >>>>> >>>> >>>> At as best guess (as the question is somewhat broken), are you asking >>>> how to make persistent connections which are guaranteed to never time out >>>> in >>>> a single session? >>>> >>>> Could you clarify a little more on your question please? >>>> >>>> Cal >>>> >>>> >>>>> >>>>> Does django has this function? And how to do for it?? >>>>> >>>>> thank you >>>>> rgs, >>>>> he >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Django users" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/django-users?hl=en. >>>>> >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Django users" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/django-users?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Django users" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/django-users?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

