jezdez/django_compressor — Issue #141: compress management command struggles with imports
Author: peterbe
Created: 2011-10-17 14:03:57+00:00
State: open

Here is the traceback:

```
$ ./manage.py compress --help
Traceback (most recent call last):
File "./manage.py", line 37, in
execute_manager(settings)
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor-local/src/django_compressor/compressor/management/commands/compress.py", line 16, in
from django.template.loader_tags import ExtendsNode, BlockNode, BLOCK_CONTEXT_KEY
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/template/loader_tags.py", line 5, in
from django.template.loader import get_template
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/template/loader.py", line 205, in
add_to_builtins('django.template.loader_tags')
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/template/base.py", line 1016, in add_to_builtins
builtins.append(import_library(module))
File "/Users/peterbe/dev/MOZILLA/ELMO/elmo/vendor/src/django/django/template/base.py", line 966, in import_library
raise InvalidTemplateLibrary("Template library %s does not have a variable named 'register'" % taglib_module)
django.template.base.InvalidTemplateLibrary: Template library django.template.loader_tags does not have a variable named 'register'
```

As you can see, it happens when it's trying to execute these lines:

```
from django.template.loader_tags import ...
```

My STATICFILES_FINDERS looks exactly like on this page: http://django_compressor.readthedocs.org/en/latest/installation/
I have the latest master of django_compressor and the same too for appconf. Strangely I can do this::

```
In [1]: import compressor

In [2]: import appconf

In [3]: from django.template.loader_tags import ExtendsNode, BlockNode, BLOCK_CONTEXT_KEY

In [4]: from django.conf import settings

In [5]: settings.STATICFILES_FINDERS
Out[5]:
('django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder')
```

I also tried the latest version off the develop branch but it didn't help.