@massover I’d been looking at the middleware docs, but was a bit confused as to why exactly it would be needed in this case.
What confused me, was this part of the docs:
Middleware can support any combination of synchronous and asynchronous requests. Django will adapt requests to fit the middleware’s requirements if it cannot support both, but at a performance penalty. […] By default, Django assumes that your middleware is capable of handling only synchronous requests.
It sounded to me like it should be no problem, since our middleware didn’t explicitly state itself as being an asynchronous middleware.
What I didn’t realise was that the old MiddlewareMixin that was used to make old-style middleware compatible with new-style middleware, was updated in Django 3.1 to add the property async_capable = True which I guess is what’s causing the issue.
I guess the quick fix here is to add async_capable = False to our middleware class.
Thank you for your input, it wasn’t at all obvious to me, and the problem would’ve been even bigger once we got to the bigger projects we have.
Much appreciated ![]()