I am working on a django project. After I successfully did the registration and login form, I have logged into the admin panel and shortly after that somehow I got this error:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'django_filters',
'startup',
'vereinsapp',
'users',
#'users.apps.UsersConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.Cs‚rfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
WSGI_APPLICATION = 'startup.wsgi.application'
LOGIN_REDIRECT_URL = '/'
Anyone know what I could try to fix it? I also tried deleting the apps.py file of 'users'. That is the structure of my project:
CodePudding user response:
In the middleware replace this line
'django.middleware.csrf.Cs‚rfViewMiddleware'
with below line
'django.middleware.csrf.CsrfViewMiddleware',