我在virtualenv下的Django 1.4.1应用程序上安装了django-pipeline但是当我运行python manage.py collectstatic
时,我得到了:
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 163, in handle_noargs
collected = self.collect()
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 119, in collect
dry_run=self.dry_run)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/storage.py", line 30, in post_process
packager.pack_stylesheets(package)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/packager.py", line 90, in pack_stylesheets
variant=package.variant, **kwargs)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/packager.py", line 100, in pack
content = compress(paths, **kwargs)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/compressors/__init__.py", line 76, in compress_css
css = getattr(compressor(verbose=self.verbose), 'compress_css')(css)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/compressors/yui.py", line 14, in compress_css
return self.compress_common(css, 'css', settings.PIPELINE_YUI_CSS_ARGUMENTS)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/compressors/yui.py", line 8, in compress_common
return self.execute_command(command, content)
File "/home/hg/VIRTUALENVS/movie/lib/python2.6/site-packages/pipeline/compressors/__init__.py", line 235, in execute_command
pipe.stdin.write(smart_str(content))
IOError: [Errno 32] Broken pipe
我的设置是:
# static
STATIC_ROOT = join(REPOSITORY_ROOT, 'static_collected')
STATIC_URL = '/static/'
STATICFILES_DIRS = (join(REPOSITORY_ROOT, 'static'),)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
# pipeline (css/js compression)
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
PIPELINE = True
PIPELINE_CSS = {
'base_style': {
'source_filenames': (
'css/style.css',
'css/effects.css',
'css/rs_style.css',
'css/jq/jquery-ui-movieplayer.css',
),
'output_filename': 'CACHE/css/style.css',
},
}
PIPELINE_JS = {
'base_scripts': {
'source_filenames': (
'js/jq/jquery.js',
'js/mv.core.js',
'js/toolbox/toolbox.core.js',
'js/swfobject.js',
'swf/jwplayer5.9.2156.js',
'js/jq/jquery-ui.custom.min.js',
'js/mongo_autocomplete.js',
'js/rs_script.js',
),
'output_filename': 'CACHE/js/scripts.js',
}
}
在添加django-pipeline之前,管理命令运行良好,它找到了所有内容,因此它不是与查找静态文件或目录权限相关的问题。
Yuicompressor已在全球范围内安装,可在/usr/local/bin/yuicompressor
下找到,因此我未在我的设置中修改PIPELINE_YUI_BINARY
。
有任何线索吗? 谢谢!
答案 0 :(得分:2)
IOError: [Errno 32] Broken pipe
此错误意味着yuicompressor
在我们有时间发送数据之前已经退出(大部分时间因为崩溃或因为未找到)。检查您的yuicompressor
路径,然后检查yuicompressor
是否确实有效。
答案 1 :(得分:0)
在设置中添加可执行文件的路径,例如
PIPELINE_YUI_BINARY = '/usr/bin/yui-compressor'
PIPELINE_LESS_BINARY = '/usr/local/lib/node_modules/less/bin/lessc'
路径可能不同(特别是对于lessc,在本例中较少使用“npm install -g less”安装)