【问题标题】:Django-pipeline producing empty filesDjango-pipeline 产生空文件
【发布时间】:2014-08-27 03:48:12
【问题描述】:

现在,在运行 python manage.py collectstatic 时会生成一个缩小文件,但它完全是空的。

这是我的 settings.py(我在 windows 环境中):

STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
PIPELINE_ENABLED = True
PIPELINE_DISABLE_WRAPPER = True
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
PIPELINE_YUI_BINARY = "C:\\path\\to\\the\\yuicompressor.jar"
PIPELINE_JS = {
    'chat': {
        'source_filenames': (
          'js/apps/chat/controllers/chatcontrollers.js',
        ),
        'output_filename': 'js/test.min.js',
    }
}
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,"static/")
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(
        BASE_DIR,
        'media_src',
    ),
)

我看到了这个回复:Django pipeline generates empty files 已经,但我的文件位于

myapp/media_src/js/apps/chat/controllers/

【问题讨论】:

    标签: django yui-compressor django-pipeline


    【解决方案1】:

    这让我得到了答案: http://www.daveoncode.com/2013/09/19/configuring-django-pipeline-by-using-closure-compiler-for-javascript-files-and-yui-compressor-for-css/

    看起来二进制文件需要是用于运行二进制文件的确切命令。在这种情况下,它应该是:

    PIPELINE_YUI_BINARY = "java -jar C:\\path\\to\\the\\yuicompressor.jar"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-27
      • 1970-01-01
      • 2013-10-12
      • 2017-09-17
      • 1970-01-01
      相关资源
      最近更新 更多