django-compressor Offline Generation Error

放肆的年华 提交于 2019-12-10 22:07:01

问题


I am trying to compress my CSS files using django-compressor, but I keep receiving this error:

compressor.exceptions.OfflineGenerationError: You have offline compression enabled but key "8369f4e513fa5b733304f4b22c67ad97" is missing from offline manifest. You may need to run "python manage.py compress".

But, I have checked the manifest file and the key is in fact there.

I have already tried with and without COMPRESS_OFFLINE=True and I am not using any inline CSS.

I am not using any special Cache Backend and it is a single server setup with Django 1.7.1 and django-compressor 1.4.

My templates are setup as follows:

base.html

{% load compress %}



{% compress css %}
    {% block extraCSS %}
        <link href="/static/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
        <link href="/static/css/mimir-navbar.css" rel="stylesheet">

        <link href="/static/css/global-custom.css" rel="stylesheet">
    {% endblock %}
{% endcompress %}

and I have a few others that use base.html as follows:

{% block extraCSS %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="/static/web_user/css/adminPanel.css"/>
{% endblock %}

Any ideas about what I could be doing wrong? Thanks in advance.


回答1:


It turns out my COMPRESS_ROOT path was wrong. It expects an absolute path, but my STATIC_ROOT variable was relative for some reason. Setting COMPRESS_ROOT to the absolute path of STATIC_ROOT fixed the problem.



来源:https://stackoverflow.com/questions/28786002/django-compressor-offline-generation-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!