The Python Oracle

After upgrade to Django 1.11 append_slash no longer works

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC C Schuberts Piano Sonata No 13 D

--

Chapters
00:00 Question
02:26 Accepted answer (Score 6)
03:22 Thank you

--

Full question
https://stackoverflow.com/questions/4649...

Accepted answer links:
[new-style middleware]: https://docs.djangoproject.com/en/1.11/t.../
[old-style middleware]: https://docs.djangoproject.com/en/1.9/to.../

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #djangourls #djangosettings

#avk47



ACCEPTED ANSWER

Score 6


Django introduced new middleware in Django 1.10. You should use the MIDDLEWARE setting if you are using new-style middleware, and MIDDLEWARE_CLASSES if you are using old-style middleware.

If you are using Django 1.10 or 1.11, then the old MIDDLEWARE_CLASSES setting is still supported, so Django should continue to redirect with the appended slash.

However, once you upgrade to Django 2.0, the MIDDLEWARE_CLASSES setting is ignored and you must switch over to MIDDLEWARE.

When you switch over to MIDDLEWARE, you should remove SessionAuthenticationMiddleware since it has no effect in 1.10 and 1.11, and is removed completely in Django 2.0.