Re: [Django] #36236: collectstatic doesn't ignore comments or --ignore for hashing

18 views
Skip to first unread message

Django

unread,
Mar 8, 2025, 11:24:54 PM3/8/25
to django-...@googlegroups.com
#36236: collectstatic doesn't ignore comments or --ignore for hashing
-------------------------------------+-------------------------------------
Reporter: ElJeffe | Owner: (none)
Type: Bug | Status: new
Component: File | Version: 5.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: collectstatic, | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ElJeffe:

Old description:

> I have some static vendor files that include commented out map files,
> which causes a value error on hashing. Since it's commented, shouldn't
> it be ignored. If not, shouldn't it be ignored if I include `--ignore
> 'js.map'`. Neither of those happen, which causes an error when trying to
> use `ManifestStaticFilesStorage`.
>
> `//# sourceMappingURL=moment-with-locales.min.js.map`
>
> ----
>

> {{{
> Post-processing 'theme/vendor/daterangepicker/node_modules/moment/min
> /moment-with-locales.min.js' failed!
>
> Traceback (most recent call last):
> File "/opt/pioneer/manage.py", line 24, in <module>
> main()
> ~~~~^^
> File "/opt/pioneer/manage.py", line 20, in main
> execute_from_command_line(sys.argv)
> ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
> File "/usr/local/lib/python3.13/site-
> packages/django/core/management/__init__.py", line 442, in
> execute_from_command_line
> utility.execute()
> ~~~~~~~~~~~~~~~^^
> File "/usr/local/lib/python3.13/site-
> packages/django/core/management/__init__.py", line 436, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
> File "/usr/local/lib/python3.13/site-
> packages/django/core/management/base.py", line 413, in run_from_argv
> self.execute(*args, **cmd_options)
> ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
> File "/usr/local/lib/python3.13/site-
> packages/django/core/management/base.py", line 459, in execute
> output = self.handle(*args, **options)
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/management/commands/collectstatic.py",
> line 209, in handle
> collected = self.collect()
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/management/commands/collectstatic.py",
> line 154, in collect
> raise processed
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/storage.py", line 375, in
> _post_process
> content = pattern.sub(converter, content)
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/storage.py", line 249, in converter
> hashed_url = self._url(
> self._stored_name,
> ...<2 lines>...
> hashed_files=hashed_files,
> )
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/storage.py", line 182, in _url
> hashed_name = hashed_name_func(*args)
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/storage.py", line 425, in
> _stored_name
> cache_name = self.clean_name(self.hashed_name(name))
> ~~~~~~~~~~~~~~~~^^^^^^
> File "/usr/local/lib/python3.13/site-
> packages/django/contrib/staticfiles/storage.py", line 143, in hashed_name
> raise ValueError(
> "The file '%s' could not be found with %r." % (filename, self)
> )
> ValueError: The file
> 'theme/vendor/daterangepicker/node_modules/moment/min/moment-with-
> locales.min.js.map' could not be found with
> <django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at
> 0xffffa4016900>.
>
> }}}

New description:

I have some static vendor files that include commented out map files,
which causes a value error on hashing. Since it's commented, shouldn't it
be ignored. If not, shouldn't it be ignored if I include `--ignore
'js.map'`. Neither of those happen, which causes an error when trying to
use `ManifestStaticFilesStorage`.

`//# sourceMappingURL=moment-with-locales.min.js.map`
`/*# sourceMappingURL=bootstrap.min.css.map */`

----


{{{
Post-processing 'theme/vendor/daterangepicker/node_modules/moment/min
/moment-with-locales.min.js' failed!

Traceback (most recent call last):
File "/opt/pioneer/manage.py", line 24, in <module>
main()
~~~~^^
File "/opt/pioneer/manage.py", line 20, in main
execute_from_command_line(sys.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/usr/local/lib/python3.13/site-
packages/django/core/management/__init__.py", line 442, in
execute_from_command_line
utility.execute()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-
packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-
packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-
packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 209, in handle
collected = self.collect()
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 154, in collect
raise processed
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/storage.py", line 375, in
_post_process
content = pattern.sub(converter, content)
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/storage.py", line 249, in converter
hashed_url = self._url(
self._stored_name,
...<2 lines>...
hashed_files=hashed_files,
)
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/storage.py", line 182, in _url
hashed_name = hashed_name_func(*args)
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/storage.py", line 425, in _stored_name
cache_name = self.clean_name(self.hashed_name(name))
~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-
packages/django/contrib/staticfiles/storage.py", line 143, in hashed_name
raise ValueError(
"The file '%s' could not be found with %r." % (filename, self)
)
ValueError: The file 'theme/vendor/daterangepicker/node_modules/moment/min
/moment-with-locales.min.js.map' could not be found with
<django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at
0xffffa4016900>.

}}}

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

Django

unread,
Mar 9, 2025, 8:57:31 AM3/9/25
to django-...@googlegroups.com
#36236: collectstatic doesn't ignore comments or --ignore for hashing
-------------------------------------+-------------------------------------
Reporter: ElJeffe | Owner: (none)
Type: Bug | Status: new
Component: File | Version: 5.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: collectstatic, | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ElJeffe:

Old description:

> I have some static vendor files that include commented out map files,
> which causes a value error on hashing. Since it's commented, shouldn't
> it be ignored. If not, shouldn't it be ignored if I include `--ignore
> 'js.map'`. Neither of those happen, which causes an error when trying to
> use `ManifestStaticFilesStorage`.
>
> `//# sourceMappingURL=moment-with-locales.min.js.map`
I've run into other fonts or files that are missing in vendor files. If a
file is missing during the hashing, can it just be skipped? This is not a
linter.. do what is there, don't fail it.
Ticket URL: <https://code.djangoproject.com/ticket/36236#comment:5>

Django

unread,
Mar 9, 2025, 8:59:33 AM3/9/25
to django-...@googlegroups.com
#36236: collectstatic doesn't ignore comments or --ignore for hashing
-------------------------------------+-------------------------------------
Reporter: ElJeffe | Owner: (none)
Type: Bug | Status: new
Component: File | Version: 5.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: collectstatic, | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ElJeffe:

Old description:

> I have some static vendor files that include commented out map files,
> which causes a value error on hashing. Since it's commented, shouldn't
> it be ignored. If not, shouldn't it be ignored if I include `--ignore
> 'js.map'`. Neither of those happen, which causes an error when trying to
> use `ManifestStaticFilesStorage`.
>
> `//# sourceMappingURL=moment-with-locales.min.js.map`
> `/*# sourceMappingURL=bootstrap.min.css.map */`
>
I've run into other fonts or images that are missing in vendor files. If a
Ticket URL: <https://code.djangoproject.com/ticket/36236#comment:6>

Django

unread,
Mar 9, 2025, 9:20:36 AM3/9/25
to django-...@googlegroups.com
#36236: collectstatic doesn't ignore comments or --ignore for hashing
-------------------------------------+-------------------------------------
Reporter: ElJeffe | Owner: (none)
Type: Bug | Status: new
Component: File | Version: 5.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: collectstatic, | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ElJeffe:

Old description:

> I have some static vendor files that include commented out map files,
> which causes a value error on hashing. Since it's commented, shouldn't
> it be ignored. If not, shouldn't it be ignored if I include `--ignore
> 'js.map'`. Neither of those happen, which causes an error when trying to
> use `ManifestStaticFilesStorage`.
>
> `//# sourceMappingURL=moment-with-locales.min.js.map`
> `/*# sourceMappingURL=bootstrap.min.css.map */`
>
**Update:** I've run into other fonts or images that are missing in vendor
files. If a file is missing during the hashing, can it just be skipped
instead of raising an error? This is not a linter.. do what is there,
Ticket URL: <https://code.djangoproject.com/ticket/36236#comment:7>

Django

unread,
Mar 9, 2025, 10:23:55 AM3/9/25
to django-...@googlegroups.com
#36236: collectstatic doesn't ignore comments or --ignore for hashing
-------------------------------------+-------------------------------------
Reporter: ElJeffe | Owner: (none)
Type: Bug | Status: new
Component: File | Version: 5.1
uploads/storage |
Severity: Normal | Resolution:
Keywords: collectstatic, | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ElJeffe:

Old description:

> I have some static vendor files that include commented out map files,
> which causes a value error on hashing. Since it's commented, shouldn't
> it be ignored. If not, shouldn't it be ignored if I include `--ignore
> 'js.map'`. Neither of those happen, which causes an error when trying to
> use `ManifestStaticFilesStorage`.
>
> `//# sourceMappingURL=moment-with-locales.min.js.map`
> `/*# sourceMappingURL=bootstrap.min.css.map */`
>
**Update:** I've run into other fonts or images that are referenced and
missing in vendor packages. If a file is missing during the hashing, can
Ticket URL: <https://code.djangoproject.com/ticket/36236#comment:8>

Django

unread,
Mar 9, 2025, 11:10:58 AM3/9/25
to django-...@googlegroups.com
#36236: collectstatic doesn't ignore comments or --ignore for hashing
-------------------------------------+-------------------------------------
Reporter: ElJeffe | Owner: (none)
Type: Bug | Status: closed
Component: File | Version: 5.1
uploads/storage |
Severity: Normal | Resolution: duplicate
Keywords: collectstatic, | Triage Stage:
ManifestStaticFilesStorage | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

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

Comment:

Duplicate of #21080.
--
Ticket URL: <https://code.djangoproject.com/ticket/36236#comment:9>
Reply all
Reply to author
Forward
0 new messages