0

My application works if I were not to add

"whitenoise.middleware.WhiteNoiseMiddleware"

into the MIDDLEWARE in settings.py

but if I were to add it back, then it would not work and would give this error

django.core.exceptions.ImproperlyConfigured: WSGI application 'story_4.wsgi.application' could not be loaded; Error importing module.

This is what is inside my wsgi.py file

#wsgi.py

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'story_4.settings')

application = get_wsgi_application()

Any answer is appreciated.

MatsuzakaSteven
  • 197
  • 1
  • 16
  • Does this answer your question? [Django ImproperlyConfigured: WSGI application 'myproject.wsgi.application' could not be loaded; Error importing module](https://stackoverflow.com/questions/47800726/django-improperlyconfigured-wsgi-application-myproject-wsgi-application-could) – bmons Feb 16 '20 at 09:25
  • @bmons There is no such as `'django.contrib.auth.middleware.SessionAuthenticationMiddleware'`, in my settings.py the nearest I could find was `'django.contrib.sessions.middleware.SessionMiddleware'`, and if I were to comment it, it would give another error which is ?: `(admin.E410) 'django.contrib.sessions.middleware.SessionMiddleware' must be in MIDDLEWARE in order to use the admin application.` – MatsuzakaSteven Feb 16 '20 at 09:33
  • Please post the full stack trace for the error. – solarissmoke Feb 16 '20 at 10:03

1 Answers1

0

Problem solved, Please remember to update your Whitenoise to the latest version with pip install --upgrade whitenoise

Mine was still at 3.3.0 and apparently django didn't like it.

MatsuzakaSteven
  • 197
  • 1
  • 16