Answer the question
In order to leave comments, you need to log in
Why does Flask use the extension system?
There are, for example, python libraries mako and WTForms. And there are corresponding flask extensions flask_mako, flask_wtforms. What for to do as a matter of fact the library realizing functionality of other library? Why not use the "original" libraries directly? Those.
import mako
import wtforms
... Read Flask's
docks, but did not find a clear explanation.
Help, please, to understand.
Answer the question
In order to leave comments, you need to log in
mako and WTForms libraries that are not tailor made for Flask.
flask_mako, flask_wtforms -- do not implement the same functionality, but should make it easier to work with mako and WTForms inside a Flask application, as well as make it easier for mako and WTForms to interact with other libraries within a Flask application.
That is, the meaning of extensions:
The first reason is explicitly stated in the Flask documentation ( flask.pocoo.org/docs/0.12/extensiondev ):
For example, flask_mako consists of 1 file ( https://github.com/benselme/flask-mako/blob/master... ) and judging by the description --
The extension does two things:
Next we see multiple imports from Flask, werkzeug and mako.
For example, debugging tools are imported from werkzeug, and exceptions from mako:
from werkzeug.debug.tbtools import Traceback, Frame, Line
...
from mako import exceptions
from mako.exceptions import RichTraceback, text_error_template
Provides support for Mako Templates in Flask.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question