0

现在,运行时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 管道已经生成空文件,但我的文件位于

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

1 回答 1

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"
于 2014-08-27T04:46:07.173 回答