Is the collect static of ManifestStaticFilesStorage buggy?

31 views
Skip to first unread message

run_the_race

unread,
Apr 12, 2024, 2:14:50 AM4/12/24
to Django users
Hi All,

When collecting the wc-take-message.min.js file, it fails to find the file x-field.min.css that is in the correct place.

This is my manifest storage that enables hashing JS modules imports:

from django.contrib.staticfiles.storage import ManifestStaticFilesStorage,

class LcManifestStaticFilesStorage(ManifestStaticFilesStorage):
    support_js_module_import_aggregation = True


However  when running collect static  it fails:

Heres a snippet from `comms/wcapp/wc-take-message.min.js`:
import w from"/static/skin/skin/x-field.min.css";import u from"/static/common/skin/

And heres the error during collect static:

Post-processing 'comms/wcapp/wc-take-message.min.js' failed!

Traceback (most recent call last):
  File "/home/michael/project/src/manage.py", line 57, in <module>
    run()
  File "/home/michael/project/src/manage.py", line 49, in run
    execute_from_command_line(sys.argv)
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael/project/src/core/app/base/management/commands/deploy.py", line 84, in handle
    call_command('collectstatic', '--noinput', '--clear', '--verbosity', '0')
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/core/management/__init__.py", line 194, in call_command
    return command.execute(*args, **defaults)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
    collected = self.collect()
                ^^^^^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 154, in collect
    raise processed
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/storage.py", line 375, in _post_process
    content = pattern.sub(converter, content)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/storage.py", line 249, in converter
    hashed_url = self._url(
                 ^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/storage.py", line 182, in _url
    hashed_name = hashed_name_func(*args)
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/storage.py", line 425, in _stored_name
    cache_name = self.clean_name(self.hashed_name(name))
                                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael/.venv/project/lib/python3.11/site-packages/django/contrib/staticfiles/storage.py", line 143, in hashed_name
    raise ValueError(
ValueError: The file 'skin/skin/x-field.min.c6fe58e9f403.css' could not be found with <base.storage.LcManifestStaticFilesStorage object at 0x7f645c578a10>.



But the file exists in the collect static spot:
:/var/www/example.com/public/static/skin/skin$ ls -la x-field.min.css
-rw-r--r-- 1 michael www-data 6387 Apr 12 08:07 x-field.min.css

Not sure why it does not see the file it's looking for?
Reply all
Reply to author
Forward
0 new messages