Offline compression error #131

Closed
dboris opened this Issue Oct 7, 2011 · 7 comments

Comments

Projects
None yet
8 participants

dboris commented Oct 7, 2011

Trying to compress media files offline results in the following error using django_compressor 1.1 with Django 1.2.5 on Mac OS X:

Traceback (most recent call last):
  File "bin/django", line 72, in 
    djangorecipe.manage.main('project.development')
  File "/Users/boris/project/eggs/djangorecipe-0.22-py2.6.egg/djangorecipe/manage.py", line 16, in main
    management.execute_manager(mod)
  File "/Users/boris/project/parts/django/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Users/boris/project/parts/django/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/boris/project/parts/django/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/boris/project/parts/django/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Users/boris/project/parts/django/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/boris/project/eggs/django_compressor-1.1-py2.6.egg/compressor/management/commands/compress.py", line 16, in 
    from django.template.loader_tags import ExtendsNode, BlockNode, BLOCK_CONTEXT_KEY
  File "/Users/boris/project/parts/django/django/template/loader_tags.py", line 3, in 
    from django.template.loader import get_template
  File "/Users/boris/project/parts/django/django/template/loader.py", line 198, in 
    add_to_builtins('django.template.loader_tags')
  File "/Users/boris/project/parts/django/django/template/__init__.py", line 1049, in add_to_builtins
    builtins.append(import_library(module))
  File "/Users/boris/project/parts/django/django/template/__init__.py", line 999, in import_library
    raise InvalidTemplateLibrary("Template library %s does not have a variable named 'register'" % taglib_module)
django.template.InvalidTemplateLibrary: Template library django.template.loader_tags does not have a variable named 'register'

vad commented Oct 10, 2011

+1

django-compressor 1.1
Django 1.3.1
osx

vad commented Oct 10, 2011

django-compressor 1.0.1 works

Contributor

richleland commented Oct 11, 2011

Dug around on this for a bit. I found that if I add the following line back in from django-compressor 1.0.1:

from django.template.loader import get_template

Everything works again. I'd really like to understand exactly why this happens, but just don't have time to dig in at the moment. I'll submit the temp fix as a pull request.

richleland added a commit to richleland/django_compressor that referenced this issue Oct 11, 2011

Having the same issue here on Mac OS X Lion with Django 1.3.1 and django_compressor 1.1. The patch by @richleland fixes it.

hynek commented Oct 17, 2011

Same on Oneiric, this bug isn't Mac related.

Contributor

peterbe commented Oct 17, 2011

For the record, I had the same problem and applying the patch in the above mentioned pull request solves it.

nsb commented Oct 21, 2011

Same issue, on Ubuntu. Applying patch fixed it for me also.

jezdez added a commit that referenced this issue Oct 28, 2011

Merge pull request #137 from richleland/offline
Re-added import statement that allows offline compression again. Refs #131

@jezdez jezdez closed this Oct 28, 2011

henzk added a commit to henzk/django-productline that referenced this issue May 23, 2014

force registration of overextends tag library
this fixes sporadic import error by importing get_template  ?!?!?!
most likely a race condition of some sort

see:
django-compressor/django-compressor#131
django-compressor/django-compressor#141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment