Google News
logo
Flask - Interview Questions
Explain how can one-request database connections in Flask?
Flask framework allows to its users to request database in three ways. They are :
 
before_request() : These connections are called before making a request and no arguments are passed
after_request() : These connections are called after making a request and response is passed that will be sent to the client.
teardown_request() : These connections are called in a situation where an exception is raised and the response are not sure to get. They are also called after the construction of response. These are not allowed to change the request, and their values can be ignored.
Advertisement