#32049: Database connection differs between Middleware and views running under
ASGI.
-------------------------------------+-------------------------------------
Reporter: Hugo Osvaldo | Owner: nobody
Barrera |
Type: Bug | Status: closed
Component: HTTP handling | Version: 3.1
Severity: Normal | Resolution: invalid
Keywords: ASGI | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Hugo Osvaldo Barrera):
You mention this is expected behaviour, but which one? `runserver` does
one thing, but `daphne` does another.
If one of them is behaving as expected, then the other is misbehaving,
right? I don't think the intent is for them to run different, is it?
Side note:
I find it curious that for non-404 views, the same db connection is used
for both the middleware and the view. The exception seems to _only_ how
the 404 view is called.
> you're going to have to find a thread-safe way of doing this if you want
to use ASGI here, now
Any hints on something that's safe?
What I'm doing right now is setting a `tenant` based on the domain name,
and this is used in various places (e.g.: by my custom staticfiles'
`Storage`).
--
Ticket URL: <https://code.djangoproject.com/ticket/32049#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.0aa34a8777c53b568bb0e3c247f0b5fd%40djangoproject.com.