extensions.rst
This file
Path
docs/extensions.rst
48 lines · 1.8 KiB
Last changed by
Merge pull request #1277 from iKevinY/doc-fixesMarkus Unterwaditzerbefore adoption82d7c49
History of this fileTake it
The walk stopped after 200 commits: lines older than 5693b9d point at it.
Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d
lines 1–10why, one step back1Flask 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 beMerge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
lines 11–12why, one step back11downloaded with :command:`easy_install` or :command:`pip`. If you add a Flask extension12as dependency to your :file:`requirements.txt` or :file:`setup.py` file they areMerge branch 'pr/839'Armin Ronacherbefore adoption5693b9d
lines 13–34why, one step back13usually 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 Before 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. If you want to develop an32application that supports Flask 0.7 or earlier you should still import33from the :data:`flask.ext` package. We provide you with a compatibility34module that provides this package for older versions of Flask. You canMerge pull request #1277 from iKevinY/doc-fixesMarkus Unterwaditzerbefore adoption82d7c49
line 35why, one step back35download it from GitHub: `flaskext_compat.py`_Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d
lines 36–47why, one step back3637And here is how you can use it::3839 import flaskext_compat40 flaskext_compat.activate()4142 from flask.ext import foo4344Once the ``flaskext_compat`` module is activated the :data:`flask.ext` will45exist and you can start importing from there.4647.. _Flask Extension Registry: http://flask.pocoo.org/extensions/Merge pull request #1132 from nicorevin/update_linksDaniel Neuhäuserbefore adoption8d3ee01
line 48why, one step back48.. _flaskext_compat.py: https://raw.githubusercontent.com/mitsuhiko/flask/master/scripts/flaskext_compat.py