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.
For more options, visit https://groups.google.com/d/optout.