s12-20160430-day15

*:first-child {
margin-top: 0 !important;
}

body>*:last-child {
margin-bottom: 0 !important;
}

/* BLOCKS
=============================================================================*/

p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}

/* HEADERS
=============================================================================*/

h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}

h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}

h1 {
font-size: 28px;
color: #000;
}

h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}

h3 {
font-size: 18px;
}

h4 {
font-size: 16px;
}

h5 {
font-size: 14px;
}

h6 {
color: #777;
font-size: 14px;
}

body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}

a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}

h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}

/* LINKS
=============================================================================*/

a {
color: #4183C4;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

/* LISTS
=============================================================================*/

ul, ol {
padding-left: 30px;
}

ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}

ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}

dl {
padding: 0;
}

dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}

dl dt:first-child {
padding: 0;
}

dl dt>:first-child {
margin-top: 0px;
}

dl dt>:last-child {
margin-bottom: 0px;
}

dl dd {
margin: 0 0 15px;
padding: 0 15px;
}

dl dd>:first-child {
margin-top: 0px;
}

dl dd>:last-child {
margin-bottom: 0px;
}

/* CODE
=============================================================================*/

pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}

code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}

pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}

pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}

pre code, pre tt {
background-color: transparent;
border: none;
}

kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}

/* QUOTES
=============================================================================*/

blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}

blockquote>:first-child {
margin-top: 0px;
}

blockquote>:last-child {
margin-bottom: 0px;
}

/* HORIZONTAL RULES
=============================================================================*/

hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}

/* TABLES
=============================================================================*/

table th {
font-weight: bold;
}

table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}

table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}

table tr:nth-child(2n) {
background-color: #f8f8f8;
}

/* IMAGES
=============================================================================*/

img {
max-width: 100%
}
-->

pytho自动化开发 day15

Date:2016.04.30

  1. @南非波波

课程大纲:

http://www.cnblogs.com/wupeiqi/articles/4491246.html http://www.cnblogs.com/wupeiqi/articles/4508271.html

一、前端设计

1.实现图片轮播

  1. js下载地址:
  2. http://bxslider.com/
  3. 引入
  4. <!-- jQuery library (served from Google) -->
  5. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  6. <!-- bxSlider Javascript file -->
  7. <script src="/js/jquery.bxslider.min.js"></script>
  8. <!-- bxSlider CSS file -->
  9. <link href="/lib/jquery.bxslider.css" rel="stylesheet" />
  10. 加载图片:
  11. <ul class="bxslider">
  12. <li><img src="/images/pic1.jpg" /></li>
  13. <li><img src="/images/pic2.jpg" /></li>
  14. <li><img src="/images/pic3.jpg" /></li>
  15. <li><img src="/images/pic4.jpg" /></li>
  16. </ul>
  17. 调用:
  18. $(document).ready(function(){
  19. $('.bxslider').bxSlider();
  20. });

2.图标资源

  1. Font Awesome
  2. http://fontawesome.io/
  3. a、图片,自己找图片,挖洞
  4. b、现成的图标
  5. css
  6. 使用样式
  7. --以前版本
  8. css
  9. 图片库
  10. 使用样式
  11. -- 现在
  12. css
  13. 字体文件
  14. 使用样式
  15. ccss
  16. 字体文件
  17. 样式
  18. =====》 大图片

3.伪类

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>响应式</title>
  6. <style>
  7. @media (min-width: 768px) {
  8. .lead {
  9. background-color: red;
  10. }
  11. }
  12. .c1 {
  13. background-color: green;
  14. }
  15. .clearfix:after {
  16. content: ".";
  17. clear: both;
  18. visibility: hidden;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <dev class="lead">
  24. 我们都是中国人
  25. </dev>
  26. <div class="c1 clearfix">
  27. <div style="float: right;">
  28. 你好
  29. </div>
  30. <div style="float: right;">
  31. china
  32. </div>
  33. <!--<div style="clear: both"></div>-->
  34. </div>
  35. </body>
  36. </html>

二、web框架

1.python web框架分类

  1. #!/usr/bin/env python
  2. #coding:utf-8
  3. import socket
  4. def handle_request(client):
  5. buf = client.recv(1024)
  6. client.send("HTTP/1.1 200 OK\r\n\r\n")
  7. client.send("Hello, Seven")
  8. def main():
  9. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  10. sock.bind(('localhost',8000))
  11. sock.listen(5)
  12. while True:
  13. connection, address = sock.accept()
  14. handle_request(connection)
  15. connection.close()
  16. if __name__ == '__main__':
  17. main()

2.MVC web框架

  1. MVCModels Views Controllers
  2. 数据库操作 模板 处理请求的函数
  3. 代码块的归类结构
  4. MTVModels Templates Views
  5. 数据库操作 模板 处理请求的函数

3.Django基础

  1. Django框架属于MTV框架。程序需要的操作的:
  2. 1.models
  3. 2.Templates
  4. 3.Views
  5. 4.urls

三、Django

1.安装

  1. pip install django 1.9.5

2.创建Django程序框架

  1. 使用命令创建
  2. django-admin startproject demo 创建projects
  3. cd demo
  4. python manage.py startapp app0 创建应用
  5. 使用pycharm进行创建项目和应用

3.执行程序

  1. 进入项目, python manage.py runserver 127.0.0.18000

4.创建数据表

  1. python manage.py makemigrations #生成配置文件
  2. python manage.py migrate #根据配置文件创建数据库相关 表

5.django默认后台管理

  1. 创建超级用户名 python manage.py createsuperuser

6.路由系统

  1. 静态路由
  2. 动态路由
  3. 安照顺序,第n个匹配的数据交给函数的第n个参数,严格按照顺序
  4. url(r'^page/(\d+)/(\d+)',views.page)
  5. 模板的方法,将匹配的参数,传给指定的形式参数
  6. url(r'^page/(?P<n1>\d+)/(?P<n2>\d+)',views.page)
  7. 二级路由
  8. app01
  9. urls.py
  10. project name
  11. URLapp01 ->include"app01.urls"

7.基本数据库操作

  1. ORM框架
  2. code first
  3. 自己写类 -->数据库表
  4. db first
  5. 自己写命令操作数据库-->更新类
  6. 使用类进行数据操作
  7. 创建类
  8. from django.db import models
  9. class UserInfo(models.Model):
  10. username = models.CharField(max_length=32)
  11. password = models.CharField(max_length=32)
  12. age = models.IntegerField()
  13. 配置
  14. setting
  15. INSTALLED_APPS = [
  16. 'django.contrib.admin',
  17. 'django.contrib.auth',
  18. 'django.contrib.contenttypes',
  19. 'django.contrib.sessions',
  20. 'django.contrib.messages',
  21. 'django.contrib.staticfiles',
  22. 'app01',
  23. ]
  24. 使用命令根据类创建表
  25. python manage.py makemigrations #生成配置文件
  26. python manage.py migrate #根据配置文件创建数据库相关 表
  27. 默认表名:
  28. appname_classname
  29. d.
  30. views中导入models
  31. e.
  32. POST提交数据
  33. settings里操作:
  34. MIDDLEWARE_CLASSES = [
  35. 'django.middleware.security.SecurityMiddleware',
  36. 'django.contrib.sessions.middleware.SessionMiddleware',
  37. 'django.middleware.common.CommonMiddleware',
  38. # 'django.middleware.csrf.CsrfViewMiddleware',
  39. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  40. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  41. 'django.contrib.messages.middleware.MessageMiddleware',
  42. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  43. ]

python开发学习-day15(前端部分知识、web框架、Django创建项目)的更多相关文章

  1. Python开发【十八章】:Web框架

    Web框架本质 1.众所周知,对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端 #!/usr/bin/env python # -*- codin ...

  2. python框架-Django创建项目

    创建项目 django-admin startproject douban//创建project cd douban python manage.py startapp books//创建app项目 ...

  3. Python 开发学习路线

    第一阶段:Python 语言基础 数据类型 流程控制 常用模块 函数.迭代器.装饰器 递归.迭代.反射 面向对象编程 购物车程序 计算器程序开发 模拟人生游戏开发 第二阶段:网络编程 Socket c ...

  4. Python学习 - 编写一个简单的web框架(一)

    自己动手写一个web框架,因为我是菜鸟,对于python的一些内建函数不是清楚,所以在写这篇文章之前需要一些python和WSGI的预备知识,这是一系列文章.这一篇只实现了如何处理url. 参考这篇文 ...

  5. python运维开发(十七)----jQuery续(示例)web框架django

    内容目录: jQuery示例 前端插件 web框架 Django框架 jQuery示例 dom事件绑定,dom绑定在form表单提交按钮地方都会绑定一个onclick事件,所有查看网站的人都能看到代码 ...

  6. Android开发学习必备的java知识

    Android开发学习必备的java知识本讲内容:对象.标识符.关键字.变量.常量.字面值.基本数据类型.整数.浮点数.布尔型.字符型.赋值.注释 Java作为一门语言,必然有他的语法规则.学习编程语 ...

  7. Python3.5学习十八 Python之Web框架 Django

    Python之Web框架: 本质:Socket 引用wsgiref创建web框架 根据web框架创建过程优化所得: 分目录管理 模板单独目录 执行不同函数单独存入一个方法py文件 Web框架的两种形式 ...

  8. python三大web框架Django,Flask,Flask,Python几种主流框架,13个Python web框架比较,2018年Python web五大主流框架

    Python几种主流框架 从GitHub中整理出的15个最受欢迎的Python开源框架.这些框架包括事件I/O,OLAP,Web开发,高性能网络通信,测试,爬虫等. Django: Python We ...

  9. Python Web框架——Django

    返回顶部 使用框架简单快速开发特定的系统. pip freeze > requirements.txt pip install -r requirements.txt 一 MVC和MTV模式 二 ...

随机推荐

  1. numpy计算路线距离

    numpy计算路线距离 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 enumerate遍历数组 np.diff函数 numpy适用数组作为索引 标记路线上的点 \[X={X1,X ...

  2. 自定义UITableViewCell的方法

    1.纯XIB/storyboard自定义.对应一个Controller的storyboard上拖拽出一个自定义Cell,并加上ReuseIdentifitor 2.纯代码自定义,通过在contentV ...

  3. [洛谷P4491] [HAOI2018]染色

    洛谷题目链接:[HAOI2018]染色 题目背景 HAOI2018 Round2 第二题 题目描述 为了报答小 C 的苹果, 小 G 打算送给热爱美术的小 C 一块画布, 这块画布可 以抽象为一个长度 ...

  4. a标签伪元素选择器

    a{ color: black; } /*未访问的链接*/ a:link{ color: red; } /*访问过的链接*/ a:visited{ color: green; } /*鼠标经过时*/ ...

  5. 20155301 2016-2017-2 《Java程序设计》第5周学习总结

    20155301 2016-2017-2 <Java程序设计>第5周学习总结 教材学习内容总结 1.1try.catch关键词,在用户不小心输入错误的时候,程序会出现错误信息,将代表错误的 ...

  6. HDU 4720 Naive and Silly Muggles 平面几何

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720 解题报告:给出一个三角形的三个顶点坐标,要求用一个最小的圆将这个三个点都包含在内,另外输入一个点 ...

  7. 对一道pwnhub的一点点记录

    一.通过ssh弱口令,建立socket5代理进内网. 1.修改proxychains配置文件vi /etc/proxychains.conf如下: 2.建立ssh隧道:ssh -qTfnN -D 70 ...

  8. POJ 2438 Children’s Dining (哈密顿图模板题之巧妙建反图 )

    题目链接 Description Usually children in kindergarten like to quarrel with each other. This situation an ...

  9. 南京邮电大学CTF密码学部分Writeup

    异性相吸 1.xor 2.hex2binary 3.len(bin(miwen))==len(bin(mingwen)) # -*- coding:utf-8 -*- file_de = open(' ...

  10. [转]QList内存释放

    QList<T> 的释放分两种情况: 1.T的类型为非指针,这时候直接调用clear()方法就可以释放了,看如下测试代码 #include <QtCore/QCoreApplicat ...