Home > database >  An object the flask
An object the flask

Time:09-17

Flask object of g
Therefore we can understand the g magical object is a global object, the object storage is the time we request all the information, just store the request this time

G: global

1 g object is specially used to store user data,
2. G objects in a request all the code in place, can be used,



G as a temporary variables, global flask process ACTS as an intermediary role, through which we can deliver some data, g to save the current request of global variables, different requests have different global variables, through different thread id the difference between



1. What is g,

1. In the flask, there is a special object is used to store user information g, g is global, the full name of the
2. G objects in a request all the code in place, can be used,

The difference between 2 g object and session

In my opinion, the biggest difference is that the session object can be across the request, as long as the session is not failure, the request of the different request will get to the same session, but not g object, g objects don't need to pipe expiration time, request a g object changed once, or to assign an

, that is, the session can be in our web site can be used at random and g is only after this request if the redirection will change
  • Related