404 on requests without trailing slash to i18n urls

后端 未结 1 2006
执念已碎
执念已碎 2021-02-20 06:18

Because of the APPEND_SLASH = True setting all requests with \"/whatever/path\" will be redirected to \"/whatever/path/\".

BUT urls definded within a

相关标签:
1条回答
  • 2021-02-20 07:19

    it doesn't work properly if the middleware's aren't in order.

    see: https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#how-django-discovers-language-preference

    that's how it should look like:

    MIDDLEWARE_CLASSES = (
       'django.contrib.sessions.middleware.SessionMiddleware',
       'django.middleware.locale.LocaleMiddleware',
       'django.middleware.common.CommonMiddleware',
       ...
    )
    
    0 讨论(0)
提交回复
热议问题