Opened 2 years ago
Closed 2 years ago
#33900 closed Bug (duplicate)
Support for finding paths in CSS source map comments seems to break manage.py collectstatic when *.map file is missing
Reported by: | Hervé Le Roy | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 4.1 |
Severity: | Normal | Keywords: | ManifestStaticFilesStorage |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Note:
See TracTickets
for help on using tickets.
Duplicate of #33353.