#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018273da3e39-0dc683e7-52ff-4007-b31e-6bf8c142a970-000000%40eu-central-1.amazonses.com.

Reply via email to