====== Plugin ====== Creating a plugin ----------------- Creating a plugin is simple. First of all, you need to create the necessary files: a file for your plugin code (in our case: ``example_plugin.py``), ``setup.py`` and a ``templates`` folder, with a Jinja template inside. It should be structured like below: .. code-block:: text plugin ├── example_plugin.py ├── setup.py └── templates └── index.html In ``example_plugin.py`` you need to create a class for your plugin inheriting from ``Plugin``:: from flask_pluginengine import Plugin class ExamplePlugin(Plugin): """ExamplePlugin Just an example plugin """ Second, you need to fill the ``setup.py``. For example:: from setuptools import setup setup( name='Example-Plugin', version='0.0.1', py_modules=['example_plugin'], entry_points={'example': {'example_plugin = example_plugin:ExamplePlugin'}} ) It's important to define a proper entry point to the plugin's class: ``'example'`` is the namespace we are going to use later in the application's configuration. Now you can install the plugin running in console:: $ pip install -e . Current plugin -------------- Very useful feature of Flask-PluginEngine is the ``current_plugin`` global value. It's a proxy to the currently active plugin. Example plugin functionality ---------------------------- Now let's give our plugin some functionality to show how you can use it. In this example we will render the plugin's template from our application. Let our ``index.html`` template display for example the plugin's title and description:: {% extends 'base.html' %} {% block content %}