Flask – Sessions
Flask is regularly referred to as a smaller scale framework, in light of the fact that a center usefulness incorporates WSGI and directing dependent on Werkzeug and layout motor dependent on Jinja2. Furthermore, Flask framework has support for treat and sessions just as web aides like JSON, static records and so forth. Clearly, this isn't sufficient for the advancement of an undeniable web application. This is the place the Flask augmentations come in picture. Flagon extensions offer extensibility to Flask framework.
There are an large number of Flask extensions available. A Flask augmentation is a Python module, which adds explicit sort of help to the Flask application. Flask Extension Registry is an index of extensions available. The required expansion can be downloaded by pip utility.
In this tutorial, we will talk about the following important Flask expansions −
Flask Mail − gives SMTP interface to Flask application
Flask WTF − includes rendering and approval of WTForms
Flask SQLAlchemy − adds SQLAlchemy backing to Flask application
Flask Sijax − Interface for Sijax - Python/jQuery library that makes AJAX simple to use in web applications
Each sort of expansion normally gives broad documentation about its use. Since an augmentation is a Python module, it should be imported for it to be utilized. Carafe augmentations are for the most part named as cup foo. To import,
from flask_foo import [class, function]
For versions of Flask later than 0.7, you can also use the syntax −
from flask.ext import foo
For this usage, a compatibility module needs to be activated. It can be installed by running flaskext_compat.py
import flaskext_compat flaskext_compat.activate() from flask.ext import foo