我正在使用django-1.3和django-staticfiles-1.2.1和django-pipeline-1.2.6,这个设置应该可以根据文档工作。
在我的项目根目录中,我有一个目录staticfiles,其中包含一个目录sass,其中包含我的sass文件。我希望看到django-pipeline编译我的sass文件,并将它们放在/static/css/master.css中
下面是我的settings.py文件的摘录
MEDIA_ROOT = '/home/jonasg/dev/projectX/media/'
STATIC_ROOT = 'static/'
STATIC_URL = '/static/'
PIPELINE=True
PIPELINE_AUTO=True
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
STATICFILES_DIRS = (
'staticfiles',
)
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
)
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.cssmin.CssminCompressor'
PIPLINE_CSS = {
'base': {
'source_filenames': (
'sass/*.sass'
),
'output_filename': 'css/master.css'
}
}
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
)
PIPELINE_SASS_BINARY='/usr/bin/sass'
STATICFILES_FINDERS = (
'staticfiles.finders.FileSystemFinder',
'staticfiles.finders.AppDirectoriesFinder',
'staticfiles.finders.DefaultStorageFinder'
) 当我运行./manage.py收集器时,来自/staticfiles的所有文件都被复制到/static中,但没有任何内容被编译或缩小。我还注意到这个命令从/media获取所有内容,并将它们放在/static中,这不是我所期望的行为。
另外,你可能已经注意到了,我使用的是django-staticfiles,如果你还在使用django-1.3,django-pipeline推荐你使用它。我不明白如果这个应用程序已经迁移到django-1.3,我为什么还要坚持使用django-staticfiles?
发布于 2012-05-20 19:03:34
SASS编译器期望您的sass文件具有扩展名.scss。看起来SASS添加了另一个扩展/语法,它将在管道的下一个版本中修复。
不要忘了像这样改变你的静态文件存储:
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'发布于 2015-09-08 19:23:57
我遇到了同样的问题,这是我的解决方案,添加
PIPELINE_STORAGE = 'pipeline.storage.PipelineCachedStorage'在你的设置中。至少对我来说是可行的。
https://stackoverflow.com/questions/10672758
复制相似问题