The example of creating a plugin

Directory with plugins for installed application: /var/www/geomongo/plugins.

To create a plugin you have to:

  • create a directory the name of which should be written by latin lowercase letters, words should be divided by underscores;
  • create empty file  in order for this directory could be python-package;
  • create file with two functions getPluginInfo() and getPluginResources().

getPluginInfo() returns the information about the plugin;  getPluginResources() is the dictionary which contains couples ‘link’: Resource’s derived class.


Let there are two classes-resource that we want to turn into a plugin.
 from flask.ext.restful import Resource
 class TestResource1(Resource):
   def get(self):
     return 'test_resource_1'
from flask.ext.restful import Resource
class TestResource2(Resource):
   def get(self):
     return 'test_resource_2'

It’s necessary to connect both classes in

# required hack in order for resource of plugin could be visible (
from test_resource_1 import TestResource1
from test_resource_2 import TestResource2

and create mandatory functions for the plugin:

def getPluginResources():
    result = {'res1': TestResource1, 'res2':TestResource2}  
    return result

def getPluginInfo():
    info = 'This plugin was creating for present plugins feature. The function getPluginResources is for return TestResource1 and TestResource2 '
    return info

Then you have to create the directory /var/www/geomongo/plugins/test_plugin and place into it files,, and empty file

Next, you need to restart the web server to run the plugins up.

   sudo service apache2 restart

After that, the plugins will be available at:



ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone

Format and connection of plugins

The form of plugins

Plugin is a set of external classes-resources connected to Geomongo. Technically, plugin is a python-package (directory with source code files and file satisfying the following rules:

  • it contains file;
  • the name of directory should be written by latin lowercase letters  and underscores should be used instead of space characters.

Directory with plugins for installed application: /var/www/geomongo/plugins.

File should contain:

  • function getPluginResources() which returns dictionary with couples ‘link’: Resource’s derived class;
  • function getPluginInfo() which returns string description of the plugin.

Plugin connection

  • the directory of plugin should be copied to  /var/www/geomongo/plugins
  • to activate the plugin administrator should run the query /<geo2tag_root_prefix>/manage_plugins?plugin_name=true (issue GT-1421)
  • to get list of enabled plugins administrator should run the query /<geo2tag_root_prefix>/plugin (issue GT-1421).
ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone