zoukankan      html  css  js  c++  java
  • Django入门笔记【六】

    入门笔记翻译整理自:https://docs.djangoproject.com/en/1.8/

    *该笔记将使用一个关于投票网络应用(poll application)的例子来阐述Django的用法。

    *静态文件(static files):images, JavaScript, CSS

    1. 自定义应用外观(look and feel)

    创建polls/static目录。Django的STATICFILES_FINDERS会寻找静态文件。在static目录下,创建polls/style.css文件。

    在polls/static/polls/style.css中添加:

    1 # polls/static/polls/style.css
    2 
    3 li a {
    4     color: green;
    5 }

    在文件polls/templates/polls/index.html顶部添加:

    1 #polls/templates/polls/index.html
    2 
    3 {% load staticfiles %}
    4 
    5 <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />

    2. 添加背景图片 

    在polls/static/polls下创建images目录,在其中放入background.gif。对style.css添加:

    1 body {
    2     background: white url("images/background.gif") no-repeat right bottom;
    3 }

    -- The End --

  • 相关阅读:
    Hyperion Planning 表单数据验证功能实现
    类型别名
    内联函数和constexpr函数
    强制类型转换
    当函数返回值是引用
    左值和右值
    const形参和实参
    const限定符
    auto与decltype
    局部对象
  • 原文地址:https://www.cnblogs.com/py-drama/p/4599706.html
Copyright © 2011-2022 走看看