The order of middleware affections the outcome. Some middleware are dependant on the functionality of other middleware. For example a middleware that requires usage of request.session should come after the SessionMiddleware.
If our GitHub code review bot spots this issue in your pull request it gives this advice:
1 | + | MIDDLEWARE =[ | |
2 | + | "django.contrib.auth.middleware.AuthenticationMiddleware", | |
3 | + | "django.contrib.sessions.middleware.SessionMiddleware", |
The order of middleware affections the outcome. Some middleware are dependant on the functionality of other middleware. For example a middleware that requires usage of request.session should come after the SessionMiddleware.
Read more4 | + | ... | |
5 | + | ] |