【发布时间】:2018-09-19 11:38:09
【问题描述】:
我有一个通过索引视图呈现的 html 模板。 它有几个引用的静态 css:
<html lang="pt-pt">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>AppGestao by Araujo</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<!--STYLE FILES START-->
{% load staticfiles %}
<!-- Bootstrap core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" type="text/css"/>
<!-- Animation library for notifications -->
<link href="{% static 'css/animate.min.css' %}" rel="stylesheet" type="text/css"/>
<!-- Light Bootstrap Table core CSS -->
<link href="{% static 'css/light-bootstrap-dashboard.css?v=1.4.0' %}" rel="stylesheet" type="text/css"/>
<!--STYLE FILES END-->
</head>
我在 APP_NAME/static/css 中有文件 如果我在没有 django 渲染和手动引用静态 css 的情况下单独运行此 html,则效果很好。 如果我通过 {%static 做到这一点,它不会。
尽管如此,当我在 chrome 中看到源代码时,它们看起来与相同的 css 链接完全相同!
【问题讨论】:
-
现在发现最后一个css文件没有正确加载,是不是某种特殊的css?它看起来不像普通的 css 类型..
-
settings.py 是什么样的? static_url, static_root?
标签: css django web static django-templates