OfflineGenerationError - 键不在清单中 Json
OfflineGenerationError - Key not in Manifest Json
Django 错误:
OfflineGenerationError at /
You have offline compression enabled but key "e3efe8ea14c9eeeff843e0280b54e1d92c293a5018e6d4a0be93a65997d8e246" is missing from offline manifest. You may need to run "python manage.py compress". Here is the original content:
然后显示我的CSS文件内容。
{% load static %}
@font-face {
font-family: 'fontawesome';
src: url('{% static "global/fontawesome-5.0.13/fa-regular-400.woff2" %}') format('woff2'), url('{% static "global/fontawesome-5.0.13/fa-regular-400.woff" %}') format('woff');
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-Regular.ttf' %}") format('truetype');
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-BoldItalic.ttf' %}") format('truetype');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-Italic.ttf' %}") format('truetype');
font-style: italic;
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-Bold.ttf' %}") format('truetype');
font-weight: bold;
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-Regular.ttf' %}") format('truetype');
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-BoldItalic.ttf' %}") format('truetype');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-Italic.ttf' %}") format('truetype');
font-style: italic;
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-Bold.ttf' %}") format('truetype');
font-weight: bold;
}
{% if newdesign %}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_bold_italic-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_bold_italic-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_bold_italic-webfont.ttf" %}') format('ttf');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_bold-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_bold-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_bold-webfont.ttf" %}') format('ttf');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_italic-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_italic-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_italic-webfont.ttf" %}') format('ttf');
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_regular-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_regular-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_regular-webfont.ttf" %}') format('ttf');
font-weight: normal;
font-style: normal;
}
{% endif %}
/* Global CSS Vars */
:root {
--header-color: #fafafa;
--themed-text: #0fbe98;
--dark: #2a2e3a;
--parakeet: #0fbe98;
--silver: #fafafa;
--forest-green: #228B22;
--putting-green: #699864;
--sap-green: #308014;
--irish-flag-green: #009900;
--olive-green: #3D9970;
}
/* THEMES */
.main-header-theme {
background-color: #fafafa;
background-color: var(--header-color);
}
.main-logo-theme {
background: url('{% static "global/trellis-word-logo.svg" %}') no-repeat;
}
.main-logo-motto-theme {
background: url({% static 'global/trellis-word-motto.svg' %}) no-repeat;
}
.logo-green {
background: url('{% static "global/trellis-word-green-300.png" %}') no-repeat;
}
.text-theme {
color: #0fbe98;
color: var(--themed-text);
}
/* width */
::-webkit-scrollbar {
width: 10px;
border-radius: 4px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f4f4f4;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #c7c9ca;
border-radius: 4px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background-color: silver;
}
html {
min-height: 100%;
}
body {
min-height: 100%;
margin: 0;
padding: 0;
text-align: left;
{% if newdesign %}
font-family: Concourse T3, sans-serif, 'fontawesome';
font-size: 18px;
{% else %}
font-family: sans-serif, 'fontawesome';
font-size: 16px;
{% endif %}
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
input:focus, textarea:focus {
outline: none;
}
....................
base.html 下面的第一行是触发 "missing" 键的内容。但是密钥应该在文件中,我已经运行压缩了。
{% compress css %}
<style>
{% include "global/base.css" %}
</style>
{% block section-style %}{% endblock %}
{% block style %}{% endblock %}
{% endcompress %}
{# The stylevars block is the only place you're allowed to use Django context vars, because it is uncompressed #}
{% block stylevars %}{% endblock %}
{# The scriptvars block is the only place you're allowed to use Django context vars, because it is uncompressed #}
{% block scriptvars %}{% endblock %}
{# Scripts are compressed with django-compressor #}
{% block section-script %}
{% compress js %}
<script type="text/javascript" src="{% static 'global/es5-shim.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/es5-sham.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/es6-shim.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/es6-sham.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/html5shiv-printshiv.min.js' %}"></script>
{% endcompress %}
<!--[if lt IE 9 ]>
{% compress js %}
<script type="text/javascript" src="{% static 'global/jquery-1.12.4.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/bootstrap-ie8-4.1.1/js/bootstrap-ie8.js' %}"></script>
<script type="text/javascript" src="{% static 'global/bootstrap-4.1.1/js/bootstrap.js' %}"></script>
{% endcompress %}
<![endif]-->
<!--[if gte IE 9]><!-->
{% compress js %}
<script type="text/javascript" src="{% static 'global/jquery-3.3.1.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/popper-1.14.3.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/bootstrap-4.1.1/js/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/fontawesome-5.0.13/fontawesome-all.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/html2canvas.js' %}"></script>
{% endcompress %}
您的 css 文件中可能包含动态部分。乍一看,if newdesign
似乎是个问题。
django-compressor 无法知道 newdesign
在运行时会有什么值,因此它无法知道这些动态部分实际上是什么样子。查看 COMPRESS_OFFLINE_CONTEXT,它可能会有所帮助。
Django 错误:
OfflineGenerationError at / You have offline compression enabled but key "e3efe8ea14c9eeeff843e0280b54e1d92c293a5018e6d4a0be93a65997d8e246" is missing from offline manifest. You may need to run "python manage.py compress". Here is the original content:
然后显示我的CSS文件内容。
{% load static %}
@font-face {
font-family: 'fontawesome';
src: url('{% static "global/fontawesome-5.0.13/fa-regular-400.woff2" %}') format('woff2'), url('{% static "global/fontawesome-5.0.13/fa-regular-400.woff" %}') format('woff');
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-Regular.ttf' %}") format('truetype');
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-BoldItalic.ttf' %}") format('truetype');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-Italic.ttf' %}") format('truetype');
font-style: italic;
}
@font-face {
font-family: 'NotoSans';
src: url(" {% static 'global/NotoSans-Bold.ttf' %}") format('truetype');
font-weight: bold;
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-Regular.ttf' %}") format('truetype');
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-BoldItalic.ttf' %}") format('truetype');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-Italic.ttf' %}") format('truetype');
font-style: italic;
}
@font-face {
font-family: 'NotoSerif';
src: url(" {% static 'global/NotoSerif-Bold.ttf' %}") format('truetype');
font-weight: bold;
}
{% if newdesign %}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_bold_italic-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_bold_italic-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_bold_italic-webfont.ttf" %}') format('ttf');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_bold-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_bold-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_bold-webfont.ttf" %}') format('ttf');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_italic-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_italic-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_italic-webfont.ttf" %}') format('ttf');
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: Concourse T3;
src: url('{% static "global/concourse_t3_regular-webfont.woff2" %}') format('woff2'),
url('{% static "global/concourse_t3_regular-webfont.woff" %}') format('woff'),
url('{% static "global/concourse_t3_regular-webfont.ttf" %}') format('ttf');
font-weight: normal;
font-style: normal;
}
{% endif %}
/* Global CSS Vars */
:root {
--header-color: #fafafa;
--themed-text: #0fbe98;
--dark: #2a2e3a;
--parakeet: #0fbe98;
--silver: #fafafa;
--forest-green: #228B22;
--putting-green: #699864;
--sap-green: #308014;
--irish-flag-green: #009900;
--olive-green: #3D9970;
}
/* THEMES */
.main-header-theme {
background-color: #fafafa;
background-color: var(--header-color);
}
.main-logo-theme {
background: url('{% static "global/trellis-word-logo.svg" %}') no-repeat;
}
.main-logo-motto-theme {
background: url({% static 'global/trellis-word-motto.svg' %}) no-repeat;
}
.logo-green {
background: url('{% static "global/trellis-word-green-300.png" %}') no-repeat;
}
.text-theme {
color: #0fbe98;
color: var(--themed-text);
}
/* width */
::-webkit-scrollbar {
width: 10px;
border-radius: 4px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f4f4f4;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #c7c9ca;
border-radius: 4px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background-color: silver;
}
html {
min-height: 100%;
}
body {
min-height: 100%;
margin: 0;
padding: 0;
text-align: left;
{% if newdesign %}
font-family: Concourse T3, sans-serif, 'fontawesome';
font-size: 18px;
{% else %}
font-family: sans-serif, 'fontawesome';
font-size: 16px;
{% endif %}
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
input:focus, textarea:focus {
outline: none;
}
....................
base.html 下面的第一行是触发 "missing" 键的内容。但是密钥应该在文件中,我已经运行压缩了。
{% compress css %}
<style>
{% include "global/base.css" %}
</style>
{% block section-style %}{% endblock %}
{% block style %}{% endblock %}
{% endcompress %}
{# The stylevars block is the only place you're allowed to use Django context vars, because it is uncompressed #}
{% block stylevars %}{% endblock %}
{# The scriptvars block is the only place you're allowed to use Django context vars, because it is uncompressed #}
{% block scriptvars %}{% endblock %}
{# Scripts are compressed with django-compressor #}
{% block section-script %}
{% compress js %}
<script type="text/javascript" src="{% static 'global/es5-shim.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/es5-sham.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/es6-shim.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/es6-sham.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/html5shiv-printshiv.min.js' %}"></script>
{% endcompress %}
<!--[if lt IE 9 ]>
{% compress js %}
<script type="text/javascript" src="{% static 'global/jquery-1.12.4.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/bootstrap-ie8-4.1.1/js/bootstrap-ie8.js' %}"></script>
<script type="text/javascript" src="{% static 'global/bootstrap-4.1.1/js/bootstrap.js' %}"></script>
{% endcompress %}
<![endif]-->
<!--[if gte IE 9]><!-->
{% compress js %}
<script type="text/javascript" src="{% static 'global/jquery-3.3.1.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/popper-1.14.3.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/bootstrap-4.1.1/js/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/fontawesome-5.0.13/fontawesome-all.min.js' %}"></script>
<script type="text/javascript" src="{% static 'global/html2canvas.js' %}"></script>
{% endcompress %}
您的 css 文件中可能包含动态部分。乍一看,if newdesign
似乎是个问题。
django-compressor 无法知道 newdesign
在运行时会有什么值,因此它无法知道这些动态部分实际上是什么样子。查看 COMPRESS_OFFLINE_CONTEXT,它可能会有所帮助。