当使用 compress
templatetags PROJECT_PATH
时,我使用 django-compressor 1.1.2
和 Django 1.4
STATIC_URL
压缩后
/static/Users/sultan/.virtualenvs/mediabox/somedia/somedia/public/media/media-cache/compressor/css/1d7cd4216904.css
当我不设置时 COMPRESS_OUTPUT_DIR = os.path.join(MEDIA_CACHE, 'compressor')
输出看起来像
/static/CACHE/css/1d7cd4216904.css
设置
STATICFILES_FINDERS = (
...
'compressor.finders.CompressorFinder'
)
COMPRESS_ENABLED = True
COMPRESS_OUTPUT_DIR = os.path.join(MEDIA_CACHE, 'compressor')
我的配置有什么问题?
谢谢,
苏丹
最佳答案
根据 the doc
django.conf.settings.COMPRESS_OUTPUT_DIR
Default : 'CACHE'
Controls the directory inside COMPRESS_ROOT that compressed files will be written to.)
我不知道你这里的MEDIA_CACHE
设置是什么,但是你不需要加入目录来生成COMPRESS_OUTPUT_DIR
,只需要给它一个相对的名字比如'compressor'
或 'cache'
尝试。
关于python - Django 1.4 和 django-compressor 奇怪之处,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11149867/