python3学习笔记十六

1.       http协议

     GET请求:数据放在url后面

   POST请求:数据放在请求体中

     

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--<form action="" method="get">-->
    <!--<p>用户名<input type="text" name="username"></p>-->
    <!--<p>密码<input type="text" name="password"></p>-->
    <!--<p><input type="submit"></p>-->
<!--</form>-->
<form action="" method="post">
    <p>用户名<input type="text" name="username"></p>
    <p>密码<input type="text" name="password"></p>
    <p><input type="submit"></p>
</form>
</body>
</html>

URL:     协议://IP:port/path/

2.         请求协议:(浏览器----->服务器)

            请求首行            GET(请求方式)         path()     协议版本       必须有

            请求头信息        key:value

Accept:   text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

Accept-Encoding:  gzip, deflate

Accept-Language:  zh-CN,zh;q=0.8

Cache-Control:  max-age=0

Connection:  keep-alive

Content-Length:  21

Content-Type: application/x-www-form-urlencoded

Cookie:   Pycharm-8a72aded=1c64571b-ebff-4d27-8943-6c4e777d2183

Host:   localhost:63342

Origin:  http://localhost:63342

Referer:http://localhost:63342/F/python/%E7%AC%AC%E5%8D%81%E5%85%AD%E5%A4%A9/get%E8%AF%B7%E6%B1%82.html?_ijt=c5iikiopi0fvpbdn75ff0bm51p

Upgrade-Insecure-Requests: 1

User-Agent:  Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

            空行

            请求体

3.        http响应协议     服务器------->浏览器

           响应首行    http1.1  200  OK   必须有

           响应头

           

Bdpagetype:

1

Bdqid:

0x9e0a8ef30000d37f

Bduserid:

0

Cache-Control:

private

Connection:

Keep-Alive

Content-Encoding:

gzip

Content-Type:

text/html; charset=utf-8

Cxy_all:

98012088_2_dg+31bb3f559a1143ec149685cbef0c934a

Date:

Thu, 11 Jan 2018 15:03:55 GMT

Expires:

Thu, 11 Jan 2018 15:03:55 GMT

P3p:

CP=" OTI DSP COR IVA OUR IND COM "

Server:

BWS/1.1

Set-Cookie:

BDRCVFR[X7WRLt7HYof]=aeXf-1x8UdYcs; path=/; domain=.baidu.com

Set-Cookie:

BDSVRTM=10; path=/

Set-Cookie:

BD_HOME=0; path=/

Set-Cookie:

H_PS_PSSID=1458_21082; path=/; domain=.baidu.com

Strict-Transport-Security:

max-age=172800

Transfer-Encoding:

chunked

Vary:

Accept-Encoding

X-Powered-By:

HPHP

X-Ua-Compatible:

IE=Edge,chrome=1

           空行

           响应体

4.      Django

         Django采用了MVC的软件设计模型:模型M,视图V和控制器C.

         Django版本对应的Python版本

         

          Django的安装

          首先安装python3.6,并添加到环境变量

          其次安装pip,并添加到环境变量

          进入python3.6的安装目录,执行命令:  pip3 install Django==1.11.9

          等待安装成功即可。

          查看Django是否安装成功。

          

   

原文地址:https://www.cnblogs.com/yangjianbo/p/8263732.html