django压缩器创建了大量缓存文件 [英] django compressor creating a lot of cache files
本文介绍了django压缩器创建了大量缓存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
服务器位于负载均衡器之后,无论出于何种原因,压缩器都会在/static/CACHE/js/
和/static/CACHE/css/代码>
The servers are behind load balancer, and for whatever reason compressor created tens of thousands of cache files in /static/CACHE/js/
and /static/CACHE/css/
我的settings.py中唯一的设置是: COMPRESS_ENABLED = True
The only setting in my settings.py is: COMPRESS_ENABLED = True
是否缺少清理CACHE文件的设置?
Is there a setting I am missing to clean up the CACHE files?
推荐答案
好吧,我想我已经找到了罪魁祸首,在compress标记内包含了一块模板生成的javascript代码,导致压缩程序继续生成新的缓存文件
OK, I think I have found the culprit, there is a piece of template generated javascript code included inside the compress tag, causing compressor to keep generating new cache files.
例如
{% compress js %}
<script src="...">
<script src="...">
var data = {{ context_data_var }};
{% endcompress %}
这篇关于django压缩器创建了大量缓存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文