예제 #1
0
def _apply_base_settings(plugin_instance, settings_module):
    # Instead of just adding the module path to the settings
    # we instantiate an app config object for the plugin
    # and explicitly set its label to its module path.
    # This way, there is no way for a plugin to collide in its
    # label in the Django App Registry with kolibri core apps
    # or Kolibri core plugins.
    app_config = AppConfig.create(plugin_instance.module_path)
    app_config.label = plugin_instance.module_path
    # Register the plugin as an installed app
    _set_setting_value("INSTALLED_APPS", (app_config, ), settings_module)
    # Add in the external plugins' locale paths. Our frontend messages depends
    # specifically on the value of LOCALE_PATHS to find its catalog files.
    if i18n.is_external_plugin(plugin_instance.module_path):
        _set_setting_value(
            "LOCALE_PATHS",
            (i18n.get_installed_app_locale_path(
                plugin_instance.module_path), ),
            settings_module,
        )
예제 #2
0
파일: base.py 프로젝트: weddingjuma/kolibri
    'kolibri.core.exams',
    'kolibri.core.device',
    'kolibri.core.discovery',
    'kolibri.core.lessons',
    'kolibri.core.analytics',
    'rest_framework',
    'django_js_reverse',
    'jsonfield',
    'morango',
] + conf.config['INSTALLED_APPS']

# Add in the external plugins' locale paths. Our frontend messages depends
# specifically on the value of LOCALE_PATHS to find its catalog files.
LOCALE_PATHS += [
    i18n.get_installed_app_locale_path(app) for app in INSTALLED_APPS
    if i18n.is_external_plugin(app) and i18n.get_installed_app_locale_path(app)
]

MIDDLEWARE = [
    'django.contrib.sessions.middleware.SessionMiddleware',
    'kolibri.core.device.middleware.KolibriLocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'kolibri.plugins.setup_wizard.middleware.SetupWizardMiddleware',
    'kolibri.auth.middleware.CustomAuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
]
예제 #3
0
    'kolibri.core.webpack',
    'kolibri.core.exams',
    'kolibri.core.device',
    'kolibri.core.discovery',
    'kolibri.core.analytics',
    'rest_framework',
    'django_js_reverse',
    'jsonfield',
    'morango',
] + conf.config['INSTALLED_APPS']

# Add in the external plugins' locale paths. Our frontend messages depends
# specifically on the value of LOCALE_PATHS to find its catalog files.
LOCALE_PATHS += [
    i18n.get_installed_app_locale_path(app) for app in INSTALLED_APPS
    if i18n.is_external_plugin(app)
]

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'kolibri.core.device.middleware.KolibriLocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'kolibri.plugins.setup_wizard.middleware.SetupWizardMiddleware',
    'kolibri.auth.middleware.CustomAuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)