2

我在我的 django 项目中使用 pyjade。我也开始使用 django 压缩器,对于性能问题,我需要使用离线压缩。

我在 settings.file 中将 COMPRESS_OFFLINE 设置为 True

我运行命令:“manage.py compress --extension=jade”来生成预编译文件和 manifest.json 文件。

问题是当我尝试渲染页面时,django 会引发异常:

OfflineGenerationError at /new/

You have offline compression enabled but key "093e0a9554a11080f060c52450f54fc1" is missing    from offline manifest. You may need to run "python manage.py compress".

我检查了我的清单,这里是:

{“608f1d299c1a9d4141630b7ebb668456”:“”}

这是我的玉模板

doctype 5

{% load compress %}
{% load staticfiles %}

html(lang="es")
  head
    meta(charset="utf-8")
    title my page {% block title %} {%endblock%}

    {% compress css %}
    link(rel="stylesheet", href="{% static 'css/style.css' %}")
    {% endcompress %}

有什么想法吗?

4

1 回答 1

0

跑步前你设置django.conf.settings.COMPRESS_OFFLINE了吗?模板期望的键似乎与清单中的键不同。事情可能只是不同步。Truepython manage.py compress

于 2014-11-28T14:43:28.557 回答