Django ImproperlyConfigured: WSGI application 'myproject.wsgi.application' could not be loaded; Error importing module

Comment out the

#'django.contrib.auth.middleware.SessionAuthenticationMiddleware',

in your settings.py file in Middleware


From my experience this happens when I try to execute runserver but I haven't installed all custom MIDDLEWARE in setting.py. After identifying and installing the middlewares the error is resolved.


Check the settings.py,

MIDDLEWARE=[
    'whitenoise.middleware.WhiteNoiseMiddleware',
]

remove 'whitenoise.middleware.WhiteNoiseMiddleware', or install Whitenoise (pip install whitenoise)