[Django] #33900: Support for finding paths in CSS source map comments seems to break manage.py collectstatic when *.map file is missing

208 views
Skip to first unread message

Django

unread,
Aug 6, 2022, 11:51:02 AM8/6/22
to django-...@googlegroups.com
#33900: Support for finding paths in CSS source map comments seems to break
manage.py collectstatic when *.map file is missing
-------------------------------------+-------------------------------------
Reporter: Hervé Le | Owner: nobody
Roy |
Type: Bug | Status: new
Component: | Version: 4.1
contrib.staticfiles | Keywords:
Severity: Normal | ManifestStaticFilesStorage
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
{{{
python manage.py collectstatic --noinput
Post-processing 'rest_framework/css/bootstrap.min.css' failed!

Traceback (most recent call last):
File "/sandbox/django4.1/mysite/manage.py", line 22, in <module>
main()
File "/sandbox/django4.1/mysite/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/core/management/__init__.py", line 446, in
execute_from_command_line
utility.execute()
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 209, in handle
collected = self.collect()
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 154, in collect
raise processed
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/storage.py", line 338, in
_post_process
content = pattern.sub(converter, content)
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/storage.py", line 215, in converter
hashed_url = self._url(
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/storage.py", line 152, in _url
hashed_name = hashed_name_func(*args)
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/storage.py", line 388, in _stored_name
cache_name = self.clean_name(self.hashed_name(name))
File "/sandbox/django4.1/venv/lib/python3.10/site-
packages/django/contrib/staticfiles/storage.py", line 113, in hashed_name
raise ValueError(
ValueError: The file 'rest_framework/css/bootstrap.min.css.map' could not
be found with
<django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at
0x7f8a9d025210>.
}}}

**Steps to reproduce the issue**

Install the following packages
{{{
Django==4.1
djangorestframework~=3.13

}}}

Start a new project
{{{
django-admin startproject mysite
}}}

Add `rest_framework` to installed apps

Update `settings.py` to use `ManifestStaticFilesStorage`

{{{
STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_STORAGE =
'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
}}}

Run `collecstatic`

It was working fine with 4.0, so my assumption is that it is related to
the newly added "Support for finding paths in CSS source map comments".
At first sight, it seems it expects the *.map file to exist, which may not
be the case, especially for packages outside of my control.

--
Ticket URL: <https://code.djangoproject.com/ticket/33900>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 6, 2022, 11:57:08 AM8/6/22
to django-...@googlegroups.com
#33900: Support for finding paths in CSS source map comments seems to break
manage.py collectstatic when *.map file is missing
-------------------------------------+-------------------------------------
Reporter: Hervé Le Roy | Owner: nobody
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: 4.1
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

Duplicate of #33353.

--
Ticket URL: <https://code.djangoproject.com/ticket/33900#comment:1>

Reply all
Reply to author
Forward
0 new messages