zoukankan      html  css  js  c++  java
  • django2.0模板相关设置

    看到了django的模板有include标签

    include 标签
    {% include %} 标签允许在模板中包含其它的模板的内容。
    
    下面这个例子都包含了 nav.html 模板:
    {% include "nav.html" %}

    然后就把页面给优化了一下

    header.html

    footer.html

    然后index.html的代码如下

    {% include "header.html" %}
    
        <div class="container" style="margin-top: 50px;">
    
          <div class="starter-template">
    
            {% for blog in blog_list %}
                <h2>{{ blog.title }}</h2>
                <p>{{ blog.timestamp }}</p>
                <p>{{ blog.body }}</p>
            {% endfor %}
    
          </div>
    
        </div><!-- /.container -->
    
     {% include "footer.html" %}

    header.html和footer.html的代码不在提供了,都是静态的内容

  • 相关阅读:
    二人组
    对于软件工程的理解
    shell 远程链接
    shell变量
    shell教程
    正则表达式--练习
    git--版本库
    git-版本回退
    git--时光穿梭
    git安装
  • 原文地址:https://www.cnblogs.com/baker95935/p/9167221.html
Copyright © 2011-2022 走看看