Python Interview Questions & Answers - Part 10


  • Team myQ

    37) Mention what is Flask-WTF and what are their features?
    Flask-WTF offers simple integration with WTForms. Features include for Flask WTF are Integration with wtforms

    • Secure form with csrf token
    • Global csrf protection
    • Internationalization integration
    • Recaptcha supporting
    • File upload that works with Flask Uploads

    38) Explain what is the common way for the Flask script to work?
    The common way for the flask script to work is

    • Either it should be the import path for your application
    • Or the path to a Python file

    39) Explain how you can access sessions in Flask?
    A session basically allows you to remember information from one request to another. In a flask, it uses a signed cookie so the user can look at the session contents and modify. The user can modify the session if only it has the secret key Flask.secret_key.


    40) Is Flask an MVC model and if yes give an example showing MVC pattern for your
    application?

    Basically, Flask is a minimalistic framework which behaves same as MVC framework. So MVC is a perfect fit for Flask, and the pattern for MVC we will consider for the following example.