Search code examples
djangoherokucontinuous-integrationgitlabwhitenoise

Adding whitenoise to django gives an "ImproperlyConfigured: WSGI application" error


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.


Solution

  • 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.