silentsokolov / django-admin-rangefilter

A Django app that lets you filter data by date range and numeric range in the admin UI
MIT License
721 stars 106 forks source link

Getting "ValueError: Missing staticfiles manifest entry for 'admin/js/calendar.js'" #63

Closed meneses-pt closed 3 years ago

meneses-pt commented 3 years ago

After upgrading to 0.8.0 I'm getting this error. I use STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' Can you help me figuring this out?

Full error:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/apps/registry.py", line 122, in populate
    app_config.ready()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/contrib/admin/apps.py", line 27, in ready
    self.module.autodiscover()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/travis/build/meneses-pt/goals.zone/ner/admin.py", line 8, in <module>
    from rangefilter.filters import DateRangeFilter
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rangefilter/filters.py", line 36, in <module>
    class OnceCallMedia(object):
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rangefilter/filters.py", line 39, in OnceCallMedia
    StaticNode.handle_simple('admin/js/calendar.js'),
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/templatetags/static.py", line 118, in handle_simple
    return staticfiles_storage.url(path)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 147, in url
    return self._url(self.stored_name, name, force)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 126, in _url
    hashed_name = hashed_name_func(*args)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 417, in stored_name
    raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
ValueError: Missing staticfiles manifest entry for 'admin/js/calendar.js'
silentsokolov commented 3 years ago
meneses-pt commented 3 years ago

I upgraded to 3.2 It happened while running collectstatic and also on test

silentsokolov commented 3 years ago

Test on: Django==3.2

Settings.py:

STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

STATIC_URL = '/static/'
STATIC_ROOT = 'static'

Command: python manage.py collectstatic --noinput --clear

Output:

...
Deleting 'admin/fonts/README.txt'
Deleting 'admin/fonts/LICENSE.txt'
Deleting 'rangefilter/iife.efe3a000e45e.js'
Deleting 'rangefilter/iife.js'

129 static files copied to '/../../app/static', 143 post-processed.

Maybe anything else?

meneses-pt commented 3 years ago

You can see it here:

https://travis-ci.com/github/meneses-pt/goals.zone/jobs/497509456

The source code is here: https://github.com/meneses-pt/goals.zone

I know it is not your job, but if you could help me out I'd appreciate.

silentsokolov commented 3 years ago
  1. I fixed it (update to 0.8.1)
  2. You don't run collectstatic before test, and:
    Due to the requirement of running collectstatic, this storage typically shouldn’t be used when running tests as collectstatic
    isn’t run as part of the normal test setup. During testing, ensure that the STATICFILES_STORAGE setting is set to something
    else like 'django.contrib.staticfiles.storage.StaticFilesStorage' (the default).

Thx

meneses-pt commented 3 years ago

Thanks. With your help this is now solved 👍