Python Learning - Day54

#Django content review 
# - The request response HTTP protocol (with or without status) is passed as a string by default
# The passed string is divided into two parts: 1.http1.1 GET /url /index + request header
# Provisional headers are shown
# Referer: https://www.baidu.com/
# User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64)
# AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
# Split Character \r\n\r\n
# 2. Request body
#
# ———————————————————————————————————— ———
## What is the lifecycle of a Django request?
# Life cycle: When the user clicks the browser, the backend will process those transactions, first generate a bunch of data and then arrive at the route map,
# The route map is matched one by one, and it will no longer match after the match is successful
# Django process:
# 1. Send HTTP request
# 2. The server receives it and matches it in the routing relationship table according to the url in the request header (from top to bottom)
# 3. After the match is successful, execute the specified view function
# URL-function ==> FBV-- Function--BASE--VIEW
# URL-class ==> CBV--Class--BASE--VIEW (the class itself cannot be processed, you need to find a way to process it)
# 1).[The class must inherit Django's class 'from django.views import View']
# 2).[url(r'^cbv$',views.CBV.as_view())]
# 4.Business processing
# -Customize according to personal needs # -Operate
database
# --pymysql
# --Support native sql
# --Django's ORM operation (--single table operation, one-to-many, many-to-many)
# ==> Generate the returned result to the user <==
# -Response content [response header and response body]
#———— ———————————————————————————————————————————————— #
# -Write Example
#

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324472953&siteId=291194637