'APPEND_SLASH doesn't work for me with Django 4
Django version 4.0.2
settings.py
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
APPEND_SLASH = True
project's urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('poolapp.urls')),
]
app's urls.py
urlpatterns = [
path('index/', index, name="index"),
]
With the same configuration, If I visit 127.0.0.1/index
, Django 3.x redirects me to 127.0.0.1/index/
.
Django 4.0.2
returns 404
.
Did something change with Django 4.x
?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|