Django-pipeline 'compressed' 不是有效的标签库:ImportError raised loading pipeline.templatetags.compressed: No module named conf

Django-pipeline 'compressed' is not a valid tag library: ImportError raised loading pipeline.templatetags.compressed: No module named conf

我遇到了这个错误,我不知道为什么我突然遇到了 django-pipeline 问题。

我是 运行 virtualenv 下的项目,我试图用所需的基本应用程序创建一个新项目,看看它是否会修复它,但我总是收到此错误:

TemplateSyntaxError at /
'compressed' is not a valid tag library: ImportError raised loading pipeline.templatetags.compressed: No module named conf
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.7.3
Exception Type: TemplateSyntaxError
Exception Value:    
'compressed' is not a valid tag library: ImportError raised loading pipeline.templatetags.compressed: No module named conf
Exception Location: /home/ymorin007/.virtualenvs/humor15b/local/lib/python2.7/site-packages/django/template/defaulttags.py in load, line 1119
Python Executable:  /home/ymorin007/.virtualenvs/humor15b/bin/python
Python Version: 2.7.6
Python Path:    
['/home/ymorin007/workspace/sites/humor15.com/src',
 '/home/ymorin007/.virtualenvs/humor15b/lib/python2.7',
 '/home/ymorin007/.virtualenvs/humor15b/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/ymorin007/.virtualenvs/humor15b/lib/python2.7/lib-tk',
 '/home/ymorin007/.virtualenvs/humor15b/lib/python2.7/lib-old',
 '/home/ymorin007/.virtualenvs/humor15b/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/ymorin007/.virtualenvs/humor15b/local/lib/python2.7/site-packages']

我的设置文件

########## COMPRESSION CONFIGURATION
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'

PIPELINE_COMPILERS = (
    'pipeline.compilers.less.LessCompiler',
)

PIPELINE_CSS = {
    'humor15': {
        'source_filenames': (
            'css/bootstrap.min.css',
            'css/base.css',
            'users/css/base.css',
            'signin/css/base.css',
            'css/media.css',
        ),
        'output_filename': 'css/humor15.css',
        'extra_context': {
            'media': 'screen,projection',
        },
    },
}

PIPELINE_JS = {
    'humor15': {
        'source_filenames': (
            'js/bootstap.min.js',
        ),
        'output_filename': 'js/humor15.js',
    }
}

########## END COMPRESSION CONFIGURATION

THIRD_PARTY_APPS = (
    'ckeditor',  # https://github.com/shaunsephton/django-ckeditor#installation
    'crispy_forms',
    'django_countries',  # https://pypi.python.org/pypi/django-countries http://en.wikipedia.org/wiki/ISO_3166-1
    'django_mobile',
    'pipeline',
    'social.apps.django_app.default',  # http://psa.matiasaguirre.net/
)

INSTALLED_APPS = DJANGO_APPS + HUMOR15_APPS + THIRD_PARTY_APPS + LOCAL_APPS

由于django-pipeline 1.4版本更改了模板标签名称,您将不得不替换:

{% load compressed %}
{% compressed_css 'foo' %}
{% compressed_js 'bar' %}

有:

{% load pipeline %}
{% stylesheet 'foo' %}
{% javascript 'bar' %}

详情见http://django-pipeline.readthedocs.org/en/latest/usage.html#templatetags