django-compressor脱机生成错误 [英] django-compressor Offline Generation Error

查看:168
本文介绍了django-compressor脱机生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用django-compressor压缩CSS文件,但是我一直收到此错误:

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.

我已经尝试使用COMPRESS_OFFLINE=True和不使用COMPRESS_OFFLINE=True,并且没有使用任何内联CSS.

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

我没有使用任何特殊的缓存后端,而是使用Django 1.7.1和django-compressor 1.4的单服务器设置.

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.

我的模板的设置如下:

base.html

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 %}

还有其他一些使用base.html的方法,如下所示:

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.

推荐答案

事实证明我的COMPRESS_ROOT路径错误.它期望一个绝对路径,但是由于某些原因,我的STATIC_ROOT变量是相对的.将COMPRESS_ROOT设置为STATIC_ROOT的绝对路径可以解决此问题.

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.

这篇关于django-compressor脱机生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆