2018-11-11 12:41:48 +00:00
|
|
|
"""passbook core app config"""
|
2018-11-28 13:01:59 +00:00
|
|
|
from importlib import import_module
|
2019-02-16 08:52:37 +00:00
|
|
|
from logging import getLogger
|
2018-11-28 13:01:59 +00:00
|
|
|
|
2018-11-11 12:41:48 +00:00
|
|
|
from django.apps import AppConfig
|
|
|
|
|
2019-02-16 08:52:37 +00:00
|
|
|
from passbook.lib.config import CONFIG
|
|
|
|
|
|
|
|
LOGGER = getLogger(__name__)
|
2018-11-11 12:41:48 +00:00
|
|
|
|
|
|
|
class PassbookCoreConfig(AppConfig):
|
|
|
|
"""passbook core app config"""
|
|
|
|
|
|
|
|
name = 'passbook.core'
|
|
|
|
label = 'passbook_core'
|
2018-11-26 16:17:32 +00:00
|
|
|
verbose_name = 'passbook Core'
|
2018-11-28 13:01:59 +00:00
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
import_module('passbook.core.rules')
|
2019-02-16 08:52:37 +00:00
|
|
|
factors_to_load = CONFIG.y('passbook.factors', [])
|
|
|
|
for factors_to_load in factors_to_load:
|
|
|
|
try:
|
|
|
|
import_module(factors_to_load)
|
|
|
|
LOGGER.info("Loaded %s", factors_to_load)
|
|
|
|
except ImportError as exc:
|
|
|
|
LOGGER.debug(exc)
|