Azpect
Azpect

Reputation: 85

Getting whitenoise.storage.MissingFileError: The file 'vendor/bootswatch/default/bootstrap.min.css.map' could not be found

When I am using whitenoise to host my static files, after entering the python manage.py collecstatic command I am getting this error:

whitenoise.storage.MissingFileError: The file 'vendor/bootswatch/default/bootstrap.min.css.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x0000029983D66570>.

but when I remove all the whitenoise configurations it works collects all the static files successfully.

Below are white noise and static files config in my settings.py:

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = 'static/'

STATICFILES_DIRS = [BASE_DIR /'static']

STATIC_ROOT = "static_root"



MIDDLEWARE = [    
    'django.middleware.security.SecurityMiddleware',    
    'whitenoise.middleware.WhiteNoiseMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

STORAGES = {    

    "staticfiles": {
        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
    },
}

Upvotes: 0

Views: 341

Answers (2)

Mohamed ElKalioby
Mohamed ElKalioby

Reputation: 2334

This is because of WHITENOISE_MANIFEST_STRICT, set it to FALSE in the settings.py file and you won't get the error.

Upvotes: 0

Azpect
Azpect

Reputation: 85

Use this :

STORAGES = {
    "staticfiles": {
        "BACKEND": "whitenoise.storage.CompressedStaticFilesStorage", 
    },
}

instead of this:

STORAGES = {    

    "staticfiles": {
        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
    },
}

Upvotes: 0

Related Questions