See the documentation for details: https://docs.djangoproject.com/en/1.10/ref/settings/#conn-max-age
Also, generally speaking maintaining a connection pool has been seen as out of scope for Django itself, and most people use a standalone connection pooler (such as pgpool for Postgres). On Thu, Dec 29, 2016 at 1:13 PM, Bobby Mozumder <[email protected]> wrote: > Hi, > > It seems Django doesn’t use a persistent DB connection whenever I use the > Request.User object. > > I always get a signal saying a new DB connection occurs when I call the > object. > > For example: > > class MyView(DetailView): > def get(self, request, slug): > print(request.user) # <--- Boom, new database connection signal > is sent here. > # continue processing view > pass > > Is that by design? Or is it an error? > > I’d like it to use the same persistent DB connection across all requests. > > I’m looking through the Django source (auth & sessions backend) and can’t > find where the DB connection is happening. I haven’t touched the User > models at all, although I do have a DB connection receiver that runs > prepared statements when the app starts - it’s where I found this. > > Any info on this is appreciated, & happy Holidays! > > -bobby > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/A56E8EB4-EE0A-477F-B8DD-F39AA43F71EB%40gmail.com > <https://groups.google.com/d/msgid/django-users/A56E8EB4-EE0A-477F-B8DD-F39AA43F71EB%40gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL13Cg8FmJRC%2Br9VoKoa3R4o_wURMc6kJGQGUB_WG5NJgcZEQg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

