Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to collect static with non-default STATICFILES_STORAGE #60

Closed
gone opened this issue Nov 30, 2017 · 4 comments
Closed

Unable to collect static with non-default STATICFILES_STORAGE #60

gone opened this issue Nov 30, 2017 · 4 comments

Comments

@gone
Copy link

gone commented Nov 30, 2017

When running collect static with a specialized staticfiles_storage, collect static will break.

This is the same issue as makinacorpus/django-leaflet#149

@asfaltboy
Copy link
Member

Hi @gone , thank you for reporting the issue. I have to admit I have not tried using django-advanced-filters with a custom STATICFILES_STORAGE class.

Can you provide a traceback for the error you experience? Also it would help to know the version of Django and django-advanced filters you're using, and which file storage engine you use; so that the issue can be reproduced.

@metamatik
Copy link
Contributor

Hi!

First of all, thank you for your work on this app, it is much appreciated :)

I apologize for barging in, but I think my team may be dealing with the same issue right now.

We just added your app to our project, which is hosted on Heroku, and which uses, as recommended, WhiteNoise for static files management.

The software package versions are as follows:

Django==1.11.7
django-advanced-filters==1.0.6

When we try to deploy that branch on a new Heroku test instance, collectstatic fails with the following traceback:

remote: -----> $ python manage.py collectstatic --noinput
remote:        INFO 2017-12-12 14:20:50,045 [apps] Mailjet PRODUCTION_MODE is disabled: only emails with ADMINS as recipients will be sent.
remote:        Traceback (most recent call last):
remote:          File "manage.py", line 21, in <module>
remote:            execute_from_command_line(sys.argv)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
remote:            utility.execute()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
remote:            django.setup()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
remote:            apps.populate(settings.INSTALLED_APPS)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 116, in populate
remote:            app_config.ready()
remote:          File "/tmp/build_fdefc15dce78bea7bdd5352049add3a7/bureauxlocaux/apps/dashboards/apps.py", line 21, in ready
remote:            admin.autodiscover()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
remote:            autodiscover_modules('admin', register_to=site)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
remote:            import_module('%s.%s' % (app_config.name, module_to_search))
remote:          File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
remote:            return _bootstrap._gcd_import(name[level:], package, level)
remote:          File "<frozen importlib._bootstrap>", line 978, in _gcd_import
remote:          File "<frozen importlib._bootstrap>", line 961, in _find_and_load
remote:          File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
remote:          File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
remote:          File "<frozen importlib._bootstrap_external>", line 678, in exec_module
remote:          File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/advanced_filters/admin.py", line 15, in <module>
remote:            from .forms import AdvancedFilterForm
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/advanced_filters/forms.py", line 248, in <module>
remote:            class AdvancedFilterForm(CleanWhiteSpacesMixin, forms.ModelForm):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/advanced_filters/forms.py", line 254, in AdvancedFilterForm
remote:            class Media:
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/advanced_filters/forms.py", line 256, in Media
remote:            ('vendor/jquery/' if USE_VENDOR_DIR else '')),
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/templatetags/static.py", line 166, in static
remote:            return StaticNode.handle_simple(path)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/templatetags/static.py", line 117, in handle_simple
remote:            return staticfiles_storage.url(path)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 162, in url
remote:            return self._url(self.stored_name, name, force)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 141, in _url
remote:            hashed_name = hashed_name_func(*args)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 432, in stored_name
remote:            raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
remote:        ValueError: Missing staticfiles manifest entry for 'admin/js/vendor/jquery/jquery.min.js'

Hope that helps, thanks in advance ^^

(PS: flagging @CedricMichaud here so he gets notifications for further messages on this topic)

@metamatik
Copy link
Contributor

Just opened a PR for an empirical fix to this issue.

@gone, if you still experience this problem, feel free to try this fix :)

@asfaltboy
Copy link
Member

I'm going to close this for now as @metamatik's fix should resolve this IIRC. Please feel free to reopen if not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants