Optional Apps

Amara.org uses several apps/packages that are stored in private github repositories that add extra functionality for paid partnerships. These apps are optional – the amara codebase runs fine without them.

This module handles adding functionality from those repositories, but only if they’re present.


Add optional repositories to the python path


Get paths to optional repositories that are present

Returns:list of paths to our optional repositories. We should add these to sys.path so that we can import the apps.

Get a list of optional apps

Returns:list of app names from our optional repositories to add to INSTALLED_APPS.

Get Django urlpatterns for URLs from our optional apps.

This function finds urlpatterns inside the urls module for each optional app. In addition a module variable can define a variable called PREFIX to add a prefix to the urlpatterns.

Returns:url patterns containing urls for our optional apps to add to our root urlpatterns
optionalapps.exec_repository_scripts(filename, globals, locals)

Add extra values to the settings module.

This function looks for files named filename in each optional repository. If that exists, then we call execfile() to run the code using the settings globals/locals. This simulates that code being inside the current scope.