django中的基本模板的CSS

时间:2015-09-18 13:57:07

标签: html css django

我正在尝试使用模板来创建我的网站。现在我的目标是模板的页脚。我使用相同的信息创建了base.html:

<html>
<head>
    <title>{% block title %}{% endblock %}</title>
    {% block url %}{% endblock %}
    <link rel = "stylesheet" href="{% static "app/css/base.css" %}"/>
</head>
<body ink="#FFFFFF" alink="#fefefe" alink="#FFFFFF" vlink="#FFFFFF">
         <div class="page-wrap">{% block content %}{% endblock %}</div>

        <footer class="site-footer">
            footer information
        </footer>

</body>
</html>

和index.html:

{% extends "app/base.html" %}
{% load staticfiles %}
        {% block title %}name of the site{% endblock %}
        {% block url %}
        some ulr's
        {% endblock %}
        {% block content %}
                {% if user.is_authenticated %}
                information when user is auth
                {% else %}
                information when user is not auth
            {% endif %} 
            {% endblock %}

base.css

* {
  margin: 0;
}
html, body {
  height: 100%;
        box-shadow: inset 36em 0 20em 1em #222222;
      opacity: 0.9;
  background-image: url(../images/photo.jpg); 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
.page-wrap {
  min-height: 100%;
  margin-bottom: -100px; 
}
.page-wrap:after {
  content: "";
  display: block;
}
.site-footer, .page-wrap:after {
  height: 100px; 
}
.site-footer {
  background: #222222;
  opacity: 1;
}

当我尝试使用此文件运行服务器时出现错误:

TemplateSyntaxError at /
Invalid block tag: 'static'
Request Method: GET
Django Version: 1.8.4
Exception Type: TemplateSyntaxError
Exception Value:    
Invalid block tag: 'static'
In template C:\project\app\templates\app\base.html, error at line 5

Invalid block tag: 'static'     <link rel = "stylesheet" href="
      {% static "app/css/base.css" %}
      "/>

如何解决此问题?非常感谢你!

0 个答案:

没有答案