Django 1.4和Django压缩机的奇异性

时间:2022-03-03 23:02:25

I use django-compressor 1.1.2 with Django 1.4 when using compress templatetags PROJECT_PATH appended to STATIC_URL after compression

在使用压缩后附加到STATIC_URL的compress templatetags PROJECT_PATH时,我使用Django压缩器1.1.2和Django 1.4

/static/Users/sultan/.virtualenvs/mediabox/somedia/somedia/public/media/media-cache/compressor/css/1d7cd4216904.css

When I don't set COMPRESS_OUTPUT_DIR = os.path.join(MEDIA_CACHE, 'compressor')

当我不设置COMPRESS_OUTPUT_DIR = os.path时。加入(MEDIA_CACHE压缩机)

Output looks like

输出的样子

/static/CACHE/css/1d7cd4216904.css

settings

设置

STATICFILES_FINDERS = (
    ...
    'compressor.finders.CompressorFinder'
)

COMPRESS_ENABLED = True
COMPRESS_OUTPUT_DIR = os.path.join(MEDIA_CACHE, 'compressor')

What is wrong with my configuration?

我的配置有什么问题?

Thanks,

谢谢,

Sultan

苏丹

1 个解决方案

#1


1  

According to the doc

根据医生

django.conf.settings.COMPRESS_OUTPUT_DIR 
Default :   'CACHE' 
Controls the directory inside COMPRESS_ROOT that compressed files will be written to.)

I don't know what's your MEDIA_CACHE setting here, but you don't need to join directories to generate COMPRESS_OUTPUT_DIR, just give it a relative name such as 'compressor' or 'cache' to try.

我不知道这里的MEDIA_CACHE设置是什么,但是您不需要连接目录来生成COMPRESS_OUTPUT_DIR,只需给它一个相对名称,如“压缩机”或“缓存”即可。

#1


1  

According to the doc

根据医生

django.conf.settings.COMPRESS_OUTPUT_DIR 
Default :   'CACHE' 
Controls the directory inside COMPRESS_ROOT that compressed files will be written to.)

I don't know what's your MEDIA_CACHE setting here, but you don't need to join directories to generate COMPRESS_OUTPUT_DIR, just give it a relative name such as 'compressor' or 'cache' to try.

我不知道这里的MEDIA_CACHE设置是什么,但是您不需要连接目录来生成COMPRESS_OUTPUT_DIR,只需给它一个相对名称,如“压缩机”或“缓存”即可。