2013-02-27 98 views
5

我剛剛將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

+0

https://github.com/jezdez/django_compressor/issues/131 – catherine 2013-02-27 03:14:18

回答

2

嗯,我不得不從內部頁面中刪除所有{% load compress %}塊,並將每個js和css包含在base.html中。現在它工作了。但我仍然很奇怪,這個問題剛發生在django更新之後。

+1

你能提供這方面的更多信息嗎?我在我的index.html上有這個問題,但是我所有的'js'和'cs'信息已經存在... – KVISH 2014-05-20 15:47:03

+0

@KVISH你有什麼解決方案嗎?我面臨同樣的問題。 – fledgling 2014-08-02 05:09:52

-2

的錯誤是告訴你,雖然你已經啓用脫機壓縮過程中從未有過運行,或者緩存爲空。

基本上,如果你告訴壓縮器不要試圖在每個HTTP請求(離線壓縮)上壓縮文件,它會查找Django的緩存系統以找到壓縮版本資源的路徑。

如果啓用脫機壓縮,並且無法找到緩存所說的應存在的文件路徑,它會嚇壞了。

+0

但是,在Django更新之後它剛剛開始發生並不奇怪? settings.py是一樣的。 – Thomas 2013-02-27 19:31:30

+0

不是。相關不是因果關係。 – 2013-02-27 19:50:51

+0

我從settings.py中檢查了我的配置,我沒有發現任何錯誤。但看看我剛剛發佈的新信息。 – Thomas 2013-03-01 00:42:23

0

我有同樣的問題,我嘗試了我在互聯網上找到的每一個可能的解決方案,但每次我運行python manage.py壓縮時我都會得到相同的錯誤。

最後,我想不是找到解決方案,爲什麼我不通過閱讀compress.py(文件的路徑在錯誤控制檯中)來調試,通過這樣做我發現壓縮標籤內部壓縮標籤。

{%壓縮JS%} {%壓縮JS%}

{%endcompress%}

{%endcompress%}

所以關鍵是始終不是他們的體現。 json文件。

相關問題