jezdez/django_compressor — Issue #191: "TemplateSyntaxError: Caught UncompressableFileError" even though COMPRESS_ENABLED = False
Author: magopian
Created: 2012-01-10 18:11:59+00:00
State: open

Use case: we've downloaded django-compressor-1.1.2 from PyPI using pip, added it to our INSTALLED_APPS, but as we're not ready to use it just yet, we've set COMPRESS_ENABLED = False in the settings.

However, if there's some missing files (in our case a missing screen.css, which isn't compiled by compass on our CI server), we have the following error:

```python
Traceback (most recent call last):
apps/account/tests.py line 1116 in test_create_email_pro_existing
response = self.client.post(self.create_view, data)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/test/client.py line 449 in post
response = super(Client, self).post(path, data=data, content_type=content_type, **extra)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/test/client.py line 259 in post
return self.request(**r)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/test/client.py line 381 in request
response = self.handler(environ)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/test/client.py line 84 in __call__
response = self.get_response(request)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/core/handlers/base.py line 169 in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/core/handlers/base.py line 218 in handle_uncaught_exception
return callback(request, **param_dict)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/utils/decorators.py line 93 in _wrapped_view
response = view_func(request, *args, **kwargs)
apps/core/views.py line 116 in server_error
return HttpResponseServerError(t.render(Context(context)))
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/template/base.py line 123 in render
return self._render(context)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/test/utils.py line 60 in instrumented_test_render
return self.nodelist.render(context)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/template/base.py line 744 in render
bits.append(self.render_node(node, context))
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/template/debug.py line 73 in render_node
result = node.render(context)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/template/loader_tags.py line 127 in render
return compiled_parent._render(context)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/test/utils.py line 60 in instrumented_test_render
return self.nodelist.render(context)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/template/base.py line 744 in render
bits.append(self.render_node(node, context))
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/django/template/debug.py line 73 in render_node
result = node.render(context)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/templatetags/compress.py line 96 in render
rendered_output = self.render_output(compressor, forced)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/templatetags/compress.py line 73 in render_output
return compressor.output(self.mode, forced=forced)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/css.py line 55 in output
return super(CssCompressor, self).output(*args, **kwargs)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/base.py line 214 in output
content = self.filter_input(forced)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/base.py line 176 in filter_input
for hunk in self.hunks(forced):
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/base.py line 135 in hunks
for kind, value, basename, elem in self.split_contents():
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/css.py line 26 in split_contents
filename = self.get_filename(basename)
/home/mathieu/.virtualenvs/rh2/lib/python2.7/site-packages/compressor/base.py line 92 in get_filename
self.finders and " or with staticfiles." or "."))
TemplateSyntaxError: Caught UncompressableFileError while rendering: 'css/screen.css' could not be found in the COMPRESS_ROOT '/home/mathieu/novapost/RH2/rh2/site-static' or with staticfiles.
```

I can absolutely confirm that COMPRESS_ENABLED is set to False.