我正在使用django管道来缩小我的CSS。在我使用PipelineCachedStorage之前,一切都是正确的,这样我就可以获得版本化的、破坏缓存的文件名。我得到以下错误:
ValueError: The file 'img/glyphicons-halflings.png' could not be found with <pipeline.storage.PipelineCachedStorage object at 0x19069d0>我已经对我的项目中的所有文件进行了处理,并发现这个PNG是在bootstrap.css中的,但是我不包括要缩小的文件。这里是我的django-管道特定设置:
PIPELINE_CSS = {
'ab': {
'source_filenames': (
'main.css',
'segment-animation.css',
),
'output_filename' : 'ab.css',
}
}
PIPELINE_YUGLIFY_BINARY = '/home/redacted/ts/redacted/node_modules/yuglify/bin/yuglify'
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'提前感谢!
编辑:
管道的新设置:
PIPELINE_COMPILERS = (
'pipeline.compilers.less.LessCompiler',
)
PIPELINE_CSS = {
'ab': {
'source_filenames': (
'bootstrap-less/bootstrap.less',
'main.css',
'segment-animation.css',
),
'output_filename' : 'ab.css',
}
}
PIPELINE_YUGLIFY_BINARY = '/home/redacted/ts/redacted/node_modules/yuglify/bin/yuglify'
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'发布于 2013-10-25 18:40:15
错误并不完全与管道有关,而是与Django的CachedStaticFilesStorage PipelineCachedStorage扩展有关。缓存存储将查找css文件中的文件引用,并将url('asset-link')和@import 'resource-link'替换为指向版本的适当链接,并附加md5哈希。
这将将url('img/glyphicons-halflings.png')转换为url('img/glyphicons-halflings.<hash>.png')。因此,如果css文件中有资产引用,但没有底层资产,post_process() of CachedStaticFilesStorage将抛出该错误。
您可以阅读更多的这里。我建议用django管道编译更少版本的引导程序,并删除不需要的更少的组件,比如图标(如果不想包含引导图标)。也可以包括适当的资产。
发布于 2014-12-01 02:35:07
我发现django-管道-宽恕包很好地解决了股票Django CachedStaticFilesStorage / PipelineCachedStorage的这个问题
https://stackoverflow.com/questions/19596112
复制相似问题