stay django in , When we visit a url when , It will enter the response through route matching html On the page .

Django Life cycle of , It means when the user enters url, Before the user sees the whole page ,django What did the backstage do ?
- When the user types url, The moment I hit enter . If you're connected to the Internet … The browser generates the request header and body , Send it to the server . The request header and body will contain the actions of the browser (action), This action is usually GET/POST.
When you send GET When asked , Will ? Divide your url And request data , Between parameters & Connect .
If the data is in English letters / Numbers , The same to send , If it's a space , Convert to +, If it's in Chinese / Other characters , You just use the string BASE64 encryption , It is concluded that such as :%E4%BD%A0%E5%A5%BD, among %XX Medium XX Is the symbol of 16 In base notation ASCII.
POST Put the submitted data in yes HTTP In the package .
Please combine GET&POST Chapter review …
- url after django Medium wsgi ( reference wsgi That section …)
- Through middleware one by one (MD)
§ What is middleware ? jiushi lei
It's time to batch process all the requests , Middleware will be used
If it's dealing with a single request , You can use decorators
Call... When you go in process_request If it's worth it , We'll do what we did before response
Come out and call process_response Must have return value .
§ I'll try again BB Two sentences : If you want to operate on batch requests , You can write your own middleware … for example : Most of the views Need to verify the current access to the page , Whether the user status is logged in .)
- Get into urls, Match in route mapping table . Once the match is successful, execute the corresponding view function , No more backward matching .
§ Replenish : There are some url It's going to have regularity in it . Then we should pay attention to the following :
§ example :
This placement order is particular . There are many conditions , The more accurate one should be on it .
- The view function queries the corresponding data according to the request of the client , Return to Django, then django I'll take the data ( The data the client wants ) In the form of a string returned to the client .
- After the client receives the returned data , After the page is rendered, it is displayed to the user .

DJango_ More articles on life cycle

  1. react Life cycle of components

    Write it at the front : After reading the article many times , I summed up a . Strengthen memory again , And looking back . One . Instantiation ( initialization ) var Button = React.createClass({ getInitialState: f ...

  2. Talking about Fragment Life cycle

    Copyright notice : This article is an original blog article , No reprint without the permission of the blogger . Microblogging : Li Shengjie Source code :AndroidDemo/Fragment If there are any mistakes in the article , Welcome to leave a message . Fragment Is in Android 3.0 in ...

  3. C# MVC 5 - Life cycle ( Application lifecycle &amp; Request lifecycle )

    This article is based on the summary of online articles . 1. Introduce This article discusses ASP.Net MVC frame MVC Request lifecycle for . MVC There are two life cycles , One is the application life cycle , The second is the request life cycle . 2. Application lifecycle Application lifecycle ...

  4. UIViewController Life cycle - Full version

    One .UIViewController Life cycle of Here's the  (NSObject) Approach is to NSObject Methods provided . Everything else is UIViewController Methods provided . load   (NSObje ...

  5. angular2 Series of tutorials ( 11、 ... and ) Route nesting 、 Routing lifecycle 、matrix URL notation

    Today we are going to talk about ng2 The second part of routing , Including routing nesting . Routing life cycle and other knowledge points . Example Examples are still examples from last class :

  6. Spring in Bean Scope of action 、 Life cycle

                                   Bean Scope of action . Life cycle Bean Scope of action Spring 3 In Chinese, it means Bean Defined 5 Middle scope , Respectively singleton( Single case ).protot ...

  7. Autofac - Life cycle

    The instance life cycle determines how each requested instance in the same service is shared . When requesting a service ,Autofac Will return a singleton (single instance Scope ), A new object (per lifetime effect ...

  8. 【 Wechat applet development • Series six 】 Life cycle and routing

    This article has more theoretical knowledge , It's all personal , I hope the readers will point out that . [ Wechat applet development • A series of articles ] introduction [ Wechat applet development • Series 2 ] View layer [ Wechat applet development • Series three ] The data layer [ Wechat Xiaocheng ...

  9. Xamarin.Android Life cycle of activities

    One . Preface Used to Android People with mobile phones are bound to find a phenomenon , When you put an app in the background , After a period of time, when you open it, you will find that the application is reopened , But the previous relevant data has not been lost . It can be seen that app Of “ life ” It's in the hands of the system , ...

Random recommendation

  1. WCF On -15:WCF Operating protocols

    Preface : In the previous article , When we define a service agreement , In its operation method will add OperationContract characteristic , This feature belongs to OperationContractAttribute class , take OperationCo ...

  2. hdu 1217 (Floyd deformation )

    link : Arbitrage Time Limit: 2000/1000 MS (Java/Others)   ...

  3. Hierarchyid( hierarchy ) data type

    Instance table structure CREATE TABLE [dbo].[Emp]( ,), ), [Org] [hierarchyid], ) INSERT INTO Emp(Name,Org) VALUES(' Wu xx' ...

  4. Python Xiecheng has a deep understanding of

    Grammatically , A process is similar to a generator , All of them contain yield Keyword function .yield Usage in the process : In association yield Usually on the right side of an expression , for example :datum = yield, Can produce value , You can also not produce ...

  5. Django Related issues

    encounter models It can't be used after the model changes migrations Generate the modified table through the following aspects 1 python makemigrations yourapp( You changed app) 2  p ...

  6. python—day15 Bao's understanding 、 Execution order 、 Execute the process 、 Loop in 、 Package import 、 absolute 、 Relative Import

    One . Bao's understanding   The package manages a series of modules with similar functions through folders ​ package : A collection of modules a key : There must be a file in the package dedicated to managing all modules in the package Package name : Name of the folder where a series of modules are stored Package name ( Package object ) The storage is the management module ...

  7. python3 Write a web crawler 22- Crawling user information

    Ideas Select the originator Choose a big one with a large number of followers or fans V As a starting point for reptiles Get a list of fans and followers Get the big data through Zhihu interface V Fan list and follow list of Get list user information Get the details of each user in the list Get fans and attention from every user ...

  8. [luogu1486][bzoj1503][NOI2004] Depressed teller 【 Balance tree treap】

    Title Description OIER A large software company , There are tens of thousands of employees . As a cashier , One of my tasks is to count the salary of each employee . It was a good job , But the depressing thing is , Our boss is fickle , Constantly adjust the salary of employees ...

  9. javascript Determine whether the properties and values of two objects are equal

    objIsEqual(obj1,obj2){// Compare two object key value pairs to see if they are equal var o1 = obj1 instanceof Object; var o2 = obj2 instanceof Obje ...

  10. windows2003 Two servers , LAN can't access each other

    Ready between two servers , Mapping network drives , But there's no connection . You can see each other's machines in the network neighborhood , But you can't access the shared file , We can't do network mapping . Search for , It's found in the firewall , Didn't put " Files and printers ...