- Flask - FastCGI
- Flask - Deployment
- Flask - Sijax
- Flask - SQLAlchemy
- Flask - SQLite
- Flask - WTF
- Flask - Mail
- Flask - Extensions
- Flask - File Uploading
- Flask - Message Flashing
- Flask - Redirect & Errors
- Flask - Sessions
- Flask - Cookies
- Sending Form Data to Template
- Flask - Request Object
- Flask - Static Files
- Flask - Templates
- Flask - HTTP Methods
- Flask - URL Building
- Flask - Variable Rules
- Flask - Routing
- Flask - Application
- Flask - Environment
- Flask - Overview
- Flask - Home
Flask Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Flask – Extensions
Flask is often referred to as a micro framework, because a core functionapty includes WSGI and routing based on Werkzeug and template engine based on Jinja2. In addition, Flask framework has support for cookie and sessions as well as web helpers pke JSON, static files etc. Obviously, this is not enough for the development of a full-fledged web apppcation. This is where the Flask extensions come in picture. Flask extensions give extensibipty to Flask framework.
There are a large number of Flask extensions available. A Flask extension is a Python module, which adds specific type of support to the Flask apppcation. Flask Extension Registry is a directory of extensions available. The required extension can be downloaded by pip utipty.
In this tutorial, we will discuss the following important Flask extensions −
Flask Mail − provides SMTP interface to Flask apppcation
Flask WTF − adds rendering and vapdation of WTForms
Flask SQLAlchemy − adds SQLAlchemy support to Flask apppcation
Flask Sijax − Interface for Sijax - Python/jQuery pbrary that makes AJAX easy to use in web apppcations
Each type of extension usually provides extensive documentation about its usage. Since an extension is a Python module, it needs to be imported for it to be used. Flask extensions are generally named as flask-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 compatibipty module needs to be activated. It can be installed by running flaskext_compat.py
import flaskext_compat flaskext_compat.activate() from flask.ext import fooAdvertisements