django-cms: The file 'cms/css/cms.base.css' could not be found with CompressedManifestStaticFilesStorage
I am stuck with this issues since yesterday, and cannot find a solution.
I use django-cookiecutter and integrated my django-cms app. Everything works fine, except when I open pages that have django-cms CSS. I get the following error:
ValueError: The file 'cms/css/cms.base.css' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7f238b1fa610>.
File "django/core/handlers/exception.py", line 39, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 217, in _get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "django/template/response.py", line 109, in render
self.content = self.rendered_content
File "django/template/response.py", line 86, in rendered_content
content = template.render(context, self._request)
File "django/template/backends/django.py", line 66, in render
return self.template.render(context)
File "opbeat/instrumentation/packages/base.py", line 63, in __call__
args, kwargs)
File "opbeat/instrumentation/packages/base.py", line 222, in call_if_sampling
return self.call(module, method, wrapped, instance, args, kwargs)
File "opbeat/instrumentation/packages/django/template.py", line 18, in call
return wrapped(*args, **kwargs)
File "django/template/base.py", line 208, in render
return self._render(context)
File "django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "django/template/base.py", line 961, in render_annotated
return self.render(context)
File "django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "django/template/base.py", line 961, in render_annotated
return self.render(context)
File "django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "django/template/base.py", line 961, in render_annotated
return self.render(context)
File "django/template/loader_tags.py", line 174, in render
return compiled_parent._render(context)
File "django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "django/template/base.py", line 961, in render_annotated
return self.render(context)
File "django/template/loader_tags.py", line 70, in render
result = block.nodelist.render(context)
File "django/template/base.py", line 994, in render
bit = node.render_annotated(context)
File "django/template/base.py", line 961, in render_annotated
return self.render(context)
File "django/templatetags/static.py", line 104, in render
url = self.url(context)
File "cms/templatetags/cms_static.py", line 31, in url
url = super(StaticWithVersionNode, self).url(context)
File "django/templatetags/static.py", line 101, in url
return self.handle_simple(path)
File "django/templatetags/static.py", line 114, in handle_simple
return staticfiles_storage.url(path)
File "django/contrib/staticfiles/storage.py", line 132, in url
hashed_name = self.stored_name(clean_name)
File "django/contrib/staticfiles/storage.py", line 292, in stored_name
cache_name = self.clean_name(self.hashed_name(name))
File "django/contrib/staticfiles/storage.py", line 95, in hashed_name
(clean_name, self))
Colelctstatic correctly copied the file and whitenoise even Post-processed the file:
django_1 | Copying '/usr/local/lib/python2.7/site-packages/cms/static/cms/css/3.4.1/cms.base.css'
django_1 | Post-processed 'cms/css/3.4.1/cms.base.css' as 'cms/css/3.4.1/cms.base.1784b3b6c6ab.css'
Here are some settings, where I believe they might have an impact:
MIDDLEWARE = (
'django.middleware.security.SecurityMiddleware',
'cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
# Your stuff goes here (save in config.middlewares)
'config.middlewares.RequireLoginMiddleware',
)
# STATIC FILE CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
STATIC_ROOT = str(ROOT_DIR('staticfiles'))
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = '/static/'
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = (
str(APPS_DIR.path('static')),
)
WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', )
MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWARE
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Anyone any idea? Any other info you need?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 28 (10 by maintainers)
Commits related to this issue
- fix issue when CachedStaticFilesStorage or similar is used for STATICFILES_STORAGE for reference: see https://github.com/divio/django-cms/issues/5740 and https://gist.github.com/punto1/9c056bb9c3... — committed to punto1/django-cms by punto1 7 years ago
- Revert "Fixed #5740 -- Issue when CachedStaticFilesStorage or similar is used" This reverts commit 8fabb5c3ef8b9283b535ea1b76f029c51d3e9c29. — committed to czpython/django-cms by czpython 7 years ago
- Merge pull request #14 from divio/release/3.4.x Revert "Fixed #5740 -- Issue when CachedStaticFilesStorage or similar… — committed to khchine5/django-cms by khchine5 7 years ago
- Fixed #5740 -- Use the correct url when ManifestStaticFilesStorage or similar is used Pulls #5964 sephii:5963-fix-static-files-manifest 4c2ff4750587f99c54fd1c887289af604ce5b22c — committed to beijaflor-io/django-cms by yamadapc 7 years ago
- Fixed #5740 -- Use the correct url when ManifestStaticFilesStorage or similar is used (#5993) — committed to django-cms/django-cms by Pankrat 7 years ago
- Fixed #5740 -- Use the correct url when ManifestStaticFilesStorage or similar is used (#5993) — committed to django-cms/django-cms by Pankrat 7 years ago
- align to the base (#1) * Fixed middleware setting fallback in compatibility function. Take 2 * Fixed #6037 -- Placeholders without content in edit mode should also fallback. (#6066) * Update IS... — committed to znbn/django-cms by znbn 4 years ago
@Jafnee we are planning in about a week or two, depending on the results from testing and the help from the community.
Until this is fixed I’m using a custom
ManifestStaticFilesStorage:Use in
settings.pylike this:This will exclude all static files paths starting with “cms/”. Because django-cms static file paths contain a version number, cache busting across versions should still work. Depends on
Django==1.10.Any idea when this will be fixed? This is causing me real problems on a customer project
Thanks so much @oesah!
@oesah & @czpython: here a gist with the steps to reproduce and the fix: https://gist.github.com/punto1/9c056bb9c3e8c9bdf0d9b0b3e51eeafc
relevant pull request: #5860
replace code for StaticWithVersionNode in django-cms/cms/templatetags/cms_static.py with: