How to know which django middlewares are asynchronous enabled and which are not?

To see what middleware Django has to adapt, you can turn on debug logging for the django. request logger and look for log messages about “Synchronous middleware … adapted” .

I have been trying to do just the same but without any luck.

This is my settings.py file:

LOGGING = {  
 'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'DEBUG',
    },
    'loggers': {
        'django.request': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}

Even though I have set up the LOGGING variable, I am not getting the output like mentioned in the documentation.

Starting server at tcp:port=8000:interface=127.0.0.1
HTTP/2 support not enabled (install the http2 and tls Twisted extras)
Configuring endpoint tcp:port=8000:interface=127.0.0.1
Listening on TCP address 127.0.0.1:8000
HTTP b'GET' request for ['127.0.0.1', 42684]
HTTP 200 response started for ['127.0.0.1', 42684]
HTTP close for ['127.0.0.1', 42684]
HTTP response complete for ['127.0.0.1', 42684]
127.0.0.1:42684 - - [22/Mar/2022:12:11:47] "GET /admin/" 200 3550
HTTP b'GET' request for ['127.0.0.1', 42684]
HTTP 200 response started for ['127.0.0.1', 42684]
HTTP close for ['127.0.0.1', 42684]
HTTP response complete for ['127.0.0.1', 42684]
127.0.0.1:42684 - - [22/Mar/2022:12:11:48] "GET /admin/core/user/" 200 9028
HTTP b'GET' request for ['127.0.0.1', 42684]
HTTP 200 response started for ['127.0.0.1', 42684]
HTTP close for ['127.0.0.1', 42684]
HTTP response complete for ['127.0.0.1', 42684]
127.0.0.1:42684 - - [22/Mar/2022:12:11:48] "GET /admin/jsi18n/" 200 3343

when I run the daphne server using,

daphne project_name.asgi:application

command.
Can anyone help me to get the output about what all middlewares are asynchronous and which are not.

I have the same issue. Our project uses tons of middleware and I struggle to believe that all of it supports async. Are there other requirements to get these warnings to appear? Will these warnings appear at startup or are there certain Django views that I should go to to have them appear? Will these warnings appear on a WSGI-based Django or only on an ASGI-based Django? Does anyone maintain a list of middleware known to not yet support async?

There are two attributes that can be set on a middleware class to indicate whether it’s async-capable. See Asynchronous support. You can look at the code for the middleware to see if those attributes are set.

OK. So if those attributes are not present then Django should assume that the middleware does not support async yet the expected warnings mentioned above do not appear. This is why I asked the questions above.

I suggest you add a 'level': 'DEBUG' to your handler console configuration.

@cclauss - I got mixed up in who wrote which post here. Please post your logger settings.