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

后端 未结 8 1357
生来不讨喜
生来不讨喜 2021-02-08 01:04

I have an almost fresh install of django and when I try to python manage.py runserver.It is is giving me this error:

ImproperlyConfigured: WSGI applicati

相关标签:
8条回答
  • 2021-02-08 01:43

    Check for the stack trace - you might find answer few lines above the line "The above exception was the direct cause of the following exception:"

    It may caused for example by using of middleware from some uninstalled third party app etc.

    0 讨论(0)
  • 2021-02-08 01:51

    For whitenoise version 4.0 or above: - The WSGI integration option for Django (which involved editing wsgi.py) has been removed. Instead, you should add WhiteNoise to your middleware list in settings.py and remove any reference to WhiteNoise from wsgi.py.

    MIDDLEWARE = [
      'django.middleware.security.SecurityMiddleware',
      'whitenoise.middleware.WhiteNoiseMiddleware',
      # ...
    ]
    
    • The 'whitenoise.django.GzipManifestStaticFilesStorage' alias has now been removed. Instead you should use the correct import path: 'whitenoise.storage.CompressedManifestStaticFilesStorage'.
    0 讨论(0)
  • 2021-02-08 01:53

    for anyone having this same issue. i just fixed it following the instructions here

    you should add WhiteNoise to your middleware list in settings.py and remove any reference to WhiteNoise from wsgi.py.

    0 讨论(0)
  • 2021-02-08 02:00

    Check the settings.py,

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

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

    0 讨论(0)
  • 2021-02-08 02:01

    Comment out the

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

    in your settings.py file in Middleware

    0 讨论(0)
  • 2021-02-08 02:02

    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.

    0 讨论(0)
提交回复
热议问题