---恢复内容开始---
请求响应Http
1发送Http请求
2 服务器接收,根据请求头中的URL在路由关系表中进行匹配(从上向下)
3匹配成功后,,执行指定的views函数,
一个URL 对应一个函数-------->这个叫FBV模式
一个URL对应一个类 ---------->这个叫CBV模式
4 业务处理
- 根据个人需求自定义
- 操作数据库
- 支持原生SQL
- Django ORM操作 (可能是史上最牛逼的ORM框架)
==》返回给用户的结果《==
- 响应内容
- 响应头
- 响应体
请求字符串:
Http://127.0.0.1:8080/index/
包括请求头和请求体
请求头
分隔号:\r\n\r\n
请求体:
phone:878989
password:1234565
oneMonth:1
响应字符串:
响应头
:authority:www.zhihu.com:method:GET:path:/notifications:scheme:httpsaccept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8accept-encoding:gzip, deflate, sdch, braccept-language:zh-CN,zh;q=0.8cookie:d_c0="AHCvL6fTiw2PTpdF8w6vNTWpdTwEWmvPYq8=|1525501915"; __guid=74140564.1941744525954978600.1525501886756.3086; _zap=e9c66e60-b752-4510-84a8-1ce84fd2e279; l_cap_id="YTU0ZmEzMDI2MWNmNGVlYmIwYTRjZjY4NjdlYzViZGM=|1526912823|929d11efe89f09b1767390336f563e9767222b20"; r_cap_id="NTU1ZmI3ODdhY2FkNDVmNmJlNjkxZjFiM2VkNjlhNGQ=|1526912823|3d23e2759164d577d6400f13f0210cd7a98d7194"; cap_id="YWU1YjYwZGIxZmE1NGJlOWJhNzZhNmNiNGE5ZWQ2ODg=|1526912823|8cc3bcb0472ff7a6280cbcca8cc196cace47cd54"; capsion_ticket="2|1:0|10:1528077024|14:capsion_ticket|44:ZDM1YTdlYzc5YTY4NDA2MzljOTdlM2FjM2FhMGUzM2U=|7370e1496d3b2036c8fda94027c2e6837bf9cdfd4bbbbda72e40e29479221243"; z_c0="2|1:0|10:1528077085|4:z_c0|92:Mi4xSmRGckF3QUFBQUFBY0s4dnA5T0xEU1lBQUFCZ0FsVk5IT2tCWEFEZk9uYVVaX1lIRThiVWlhV0F2cEJvRnVoWkt3|ac8515ac03a58fb2743438dd1e28bdd92574da220a9b730ea5f67949f49bfbf3"; tgw_l7_route=170010e948f1b2a2d4c7f3737c85e98c; _xsrf=177c2830-bbc3-454d-80e9-797a6c8cc8c0; q_c1=ba7394cab466412b945e887cbbf01e70|1528242348000|1525612325000; monitor_count=6; __utma=51854390.321656243.1528242495.1528242495.1528242495.1; __utmb=51854390.0.10.1528242495; __utmc=51854390; __utmz=51854390.1528242495.1.1.utmcsr=zhihu.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmv=51854390.100--|2=registration_date=20160904=1^3=entry_date=20160904=1referer:https://www.zhihu.com/topicupgrade-insecure-requests:1user-agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
分隔符:\r\n\r\n
响应体:
.....html文件
-------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
--------------------------------------- CBV--------------------------------------
URL 文件中的需要加上 as_view()
创建类时,需要先倒入View 然后用创建的类来继承View
-----------------------------------------------------------响应结果分为响应头和响应体
响应头和响应体的创建
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
写project 流程
---恢复内容结束---