【问题标题】:django-pipeline does not workdjango-pipeline 不起作用
【发布时间】:2016-03-16 05:13:52
【问题描述】:

我正在尝试使 django-pipeline 工作,但它只是不起作用。下面是我的看法。我在应用部分添加了“管道”。

这是我尝试打开网站时的错误: “设置”对象没有属性“管道”

以下是我的设置:

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]

STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn')

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
)

PIPELINE_JS = {
    'stats': {
        'source_filenames': (
          'js/base.js',
        ),
        'output_filename': 'site-js-min.js',
    }
}


PIPELINE_CSS = {
    'colors': {
        'source_filenames': (
          'css/base.css',
        ),
        'output_filename': 'site-css-min.css',
        'variant': 'datauri',
        'extra_context': {
            'media': 'screen,projection',
        }
    }
}

【问题讨论】:

标签: django django-pipeline


【解决方案1】:

As per the docs,您需要在settings.py 中定义PIPELINE 变量,如下所示,

PIPELINE = {
    'PIPELINE_ENABLED': True,
    'JAVASCRIPT': {
        'stats': {
            'source_filenames': (
              'js/jquery.js',
              'js/d3.js',
              'js/collections/*.js',
              'js/application.js',
            ),
            'output_filename': 'js/stats.js',
        }
    }
}

【讨论】:

  • 感谢您的回复!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-25
  • 1970-01-01
  • 1970-01-01
  • 2012-04-29
  • 1970-01-01
  • 2022-11-11
相关资源
最近更新 更多