django升级后脱机压缩(django_compressor应用程序)错误
问题描述:
我刚刚将Django 1.4.2升级到1.5,并开始在django_compressor上遇到错误。django升级后脱机压缩(django_compressor应用程序)错误
You have offline compression enabled but key "eb225276268ea55d3b90c71df63109d9" is missing from offline manifest. You may need to run "python manage.py compress".
此外,我更新django_compressor到最后的版本(实际1.2),仍然得到相同的错误。
当我尝试python manage.py compress
我注意到:
c:\python27\lib\site-packages\django\utils\hashcompat.py:9: DeprecationWarning: django.utils.hashcompat is deprecated; use hashlib instead DeprecationWarning)
,这个消息与离线压缩错误有关系吗?
[增订] 我发现另一个有趣的事情......
在,我有问题,我删除了所有的CSS应该压缩的模板:
{% extends "base.html" %}
{% block head %}
{% load compress %}
{% compress css %}
{% endcompress %}
{% endblock %}
...
我跑蟒蛇管理:
python manage.py compress
python manage.py collectstatic --noinput
没有错误。
但是...问题仍然存在。
You have offline compression enabled but key "e764a8b7e7e314ed8c98aa5d25fc76b4" is missing from offline manifest. You may need to run "python manage.py compress".
1 {% extends "base.html" %}
2 {% block head %}
3 {% load compress %}
4 {% compress css %}
5
6 {% endcompress %}
7 {% endblock %}
8
另一个重要信息:.html文件被列为当我跑python manage.py compress
答
号
的错误是告诉你,虽然你已经启用脱机压缩过程中从未有过运行,或者缓存为空。
基本上,如果你告诉压缩器不要试图在每个HTTP请求(离线压缩)上压缩文件,它会查找Django的缓存系统以找到压缩版本资源的路径。
如果启用脱机压缩,并且无法找到缓存所说的应存在的文件路径,它会吓坏了。
答
我有同样的问题,我尝试了我在互联网上找到的每一个可能的解决方案,但每次我运行python manage.py压缩时我都会得到相同的错误。
最后,我想不是找到解决方案,为什么我不通过阅读compress.py(文件的路径在错误控制台中)来调试,通过这样做我发现压缩标签内部压缩标签。
{%压缩JS%} {%压缩JS%}
{%endcompress%}
{%endcompress%}
所以关键是始终不是他们的体现。 json文件。
https://github.com/jezdez/django_compressor/issues/131 – catherine 2013-02-27 03:14:18