miracle2k / django-assets

Django webassets integration.
BSD 2-Clause "Simplified" License
89 stars 79 forks source link

Django template tag requires undocumented setting ASSETS_UPDATER #32

Closed qris closed 10 years ago

qris commented 10 years ago

When I try to {% load assets %} in a template, I get the following error:

  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 73, in super
    return mark_safe(self.render(self.context))
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/django/template/debug.py", line 74, in render_node
    return node.render(context)
  File "/home/chris/washwatch/washwatch/django/website/.ve/src/django-assets/django_assets/templatetags/assets.py", line 71, in render
    for url in bundle.urls(env=get_env()):
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/webassets/bundle.py", line 685, in urls    urls.extend(bundle._urls(env, extra_filters, *args, **kwargs))
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/webassets/bundle.py", line 647, in _urls
    *args, **kwargs)
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/webassets/bundle.py", line 494, in _build
    if env.updater else True
  File "/home/chris/washwatch/washwatch/django/website/.ve/local/lib/python2.7/site-packages/webassets/env.py", line 589, in get_updater
    updater = get_updater(self.config['updater'])
  File "/home/chris/washwatch/washwatch/django/website/.ve/src/django-assets/django_assets/env.py", line 69, in __getitem__
    self._transform_key(key))
KeyError: "Django settings doesn't define ASSETS_UPDATER"

What is this mysterious setting ASSETS_UPDATER? What are the valid values? I can't see anything about it in the documentation, and the release notes for webassets 0.10 only say that I'm not allowed to set it to False any more. Fine, so what am I allowed to set it to?

miracle2k commented 10 years ago

By default webassets looks at timestamps to see if files changed, and that setting would allow you to switch out that behaviour; its never needed and I almost removed it.

I don't think this is related to the setting per se though. What should happen is that the Environment class in webassets sets to "updater" configuration value to a default value during __init__, and the django-assets proxy should redirect this to the Django ASSETS_UPDATER setting. If you somehow switch out or mess in unexpected ways with the Django environment object, this is the kind of thing I would expect to see.

It is kind of a bug in webassets that it requires the configuration to be initialized in a certain way by itself.

qris commented 10 years ago

Yeah i think we've fixed it, pull request on the way.

qris commented 10 years ago

https://github.com/miracle2k/django-assets/pull/33