2

我已经安装了 django-pipeline 包,它可以在我的本地计算机上完美运行。

当我在生产中运行 collectstatic 时会出现问题,并且出现此错误:

raise CompressorError(stderr) pipeline.exceptions.CompressorError: b'/usr/bin/env: \xe2\x80\x98yuglify\xe2\x80\x99: No such file or directory\n'

我也尝试过使用不同的压缩机,但它也不起作用。

这是我的设置:

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

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

STATIC_URL = '/static/'
STATIC_ROOT = '/home/user/app/static'

MEDIA_ROOT = '/home/user/app/src/media'
MEDIA_URL = '/media/'


PIPELINE = {
    'PIPELINE_ENABLED': True,
    'STYLESHEETS': {
        'main': {
            'source_filenames': (
              '/home/user/app/static/css/main.css',
            ),
            'output_filename': 'css/main.css',
        },
    },
    'JAVASCRIPT': {
        'main': {
            'source_filenames': (
              '/home/user/app/static/js/main.js',
            ),
            'output_filename': 'js/main.js',
        }
    }
}

PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor'
PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor'

我究竟做错了什么?

太感谢了!

4

1 回答 1

2

看起来您的环境中没有安装 yuglify。

我假设您正在处理 unix,因此很容易确认:运行命令which yuglify以查看它的安装位置,如果没有收到任何结果,您应该在环境中安装 yuglify。

我个人是通过npm顺利安装的:npm -g install yuglify

于 2019-03-11T16:04:42.740 回答