4π
β
As per documentation
, middleware configuration should be like this:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
And you can remove the whitenoise related lines from wsgi file as well:
import os
from django.core.wsgi import get_wsgi_application
# from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ss.settings')
application = get_wsgi_application()
# application = DjangoWhiteNoise(application)
Because in whitenoise >= 4.0
, you donβt need to change in wsgi file.
π€ruddra
0π
Your wsgi.py
file is incorrect.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{PROJECT}}.settings')
The code above is the issue, you need to replace {{ project }}
with your actual app name.
Itβs the folder name where the settings.py
is located.
For example, if this is your project structure.
blog
...
- settings.py
- wsgi.py
...
Then the correct code is os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blog.settings')
π€Kareem
- [Django]-Django giving error ImportError: No module named 'corsheaders'
- [Django]-Django β Custom Template Tag passing keyword args
- [Django]-Passing data to Google Charts with Django
- [Django]-South β migrating django application from sqlite to mysql
- [Django]-Django OAuth2 Error: invalid_client and client_id=None when client_id has been provided
Source:stackexchange.com