Skip to content
Myr

Started extensions introduction document

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent e944167 · Browse files · 2 files+49 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+49 added−0 removed

  • other:+49 added−0 removed

2 files+49 added−0 removed

modified:docs/contents.rst.inc+1 added
18 unmodified lines
19 signals20 views21 reqcontext22 blueprints23 extensions24 shell25 patterns/index26 deploying/index27 becomingbig
29 unmodified lines
added:docs/extensions.rst+48 added
1Flask Extensions2================34Flask extensions extend the functionality of Flask in various different5ways. For instance they add support for databases and other common tasks.67Finding Extensions8------------------910Flask extensions are listed on the `Flask Extension Registry`_ and can be11downloaded with ``easy_install`` or ``pip``. If you add a Flask extension12as dependency to your ``requirements.rst`` or ``setup.py`` file they are13usually installed with a simple command or when your application installs.1415Using Extensions16----------------1718Extensions typically have documentation that goes along that shows how to19use it. There are no general rules in how extensions are supposed to20behave but they are imported from common locations. If you have an21extension called ``Flask-Foo`` or ``Foo-Flask`` it will be always22importable from ``flask.ext.foo``::2324 from flask.ext import foo2526Flask < 0.827-----------2829If you are using Flask 0.7 or earlier the :data:`flask.ext` package will not30exist, instead you have to import from ``flaskext.foo`` or ``flask_foo``31depending on how the extension is distributed.3233We recommend importing from ``flask.ext`` even with older versions of34Flask however. If you have an application that needs to work with35versions of Flask older than 0.8 you should activate the36``flaskext_compat`` module which provides the ``flask.ext`` module. You37can download it from github: `flaskext_compat.py`_3839You can use it like this::4041 import flaskext_compat42 from flask.ext import foo4344Once the ``flaskext_compat`` module is imported the :data:`flask.ext` will45exist and you can start importing from there.4647.. _Flask Extension Registry: http://flask.pocoo.org/extensions/48.. _flaskext_compat.py: https://github.com/mitsuhiko/flask/raw/master/scripts/flaskext_compat.py