You add each of those middlewares to the stack, and run the application:
{{{
File "/path/to/django/contrib/auth/middleware.py", line 23, in
process_request
) % ("_CLASSES" if settings.MIDDLEWARE is None else "")
AssertionError: The Django authentication middleware requires session
middleware to be installed. Edit your MIDDLEWARE setting to insert
'django.contrib.sessions.middleware.SessionMiddleware' before
'django.contrib.auth.middleware.AuthenticationMiddleware'
}}}
Ignoring the fact that it ''should'' be a system check, and it's an
unfortunate side-effect of spanning 2 separate contrib apps that it isn't,
if the order of the errors output was updated, we'd not see this exception
in this specific scenario.
--
Ticket URL: <https://code.djangoproject.com/ticket/31616>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* version: 3.0 => master
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
I agree that we can do sth better here, but I'm not sure if maintaining
the order of checks is feasible in a long-term. I would add a hint to the
`E410`, e.g.
> Insert 'django.contrib.sessions.middleware.SessionMiddleware' before
'django.contrib.auth.middleware.AuthenticationMiddleware'.
--
Ticket URL: <https://code.djangoproject.com/ticket/31616#comment:1>
* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/12973 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31616#comment:2>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"18759b2209ff556aed7f20d83cbf23e3d234e41c" 18759b22]:
{{{
#!CommitTicketReference repository=""
revision="18759b2209ff556aed7f20d83cbf23e3d234e41c"
Fixed #31616 -- Added hint about middleware ordering for SessionMiddleware
admin check.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31616#comment:3>