Explain how can one-request database connections in Flask?

devquora
devquora

Posted On: Feb 22, 2018

 

Flask framework allows to its users to request database in three ways. They are as follows:

  • 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.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Python Flask Interview Questions

    What are the features of Flask Python?

    Flask Python is one of the newest frameworks of Python and is used for designing web applications for the following feat..

    Python Flask Interview Questions

    What are the advantages of Flask Python?

    Flask Python comes with all the advantages of Python and some additional pros of it are:Flasks design is lightweight ..

    Python Flask Interview Questions

    What is Flask-WTF and what are their features?

    Flask-WTF is featured to offer simple integration with WTForms. The Features include for Flask WTF are:Provides Integr..