3

我收到了这个错误,我不知道为什么突然我遇到了 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
4

1 回答 1

12

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

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

和 :

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

有关详细信息,请参阅http://django-pipeline.readthedocs.org/en/latest/usage.html#templatetags

于 2015-01-15T20:13:51.143 回答