def check_plugin_config_file_location(version): if matches_version(version, "<0.13.0"): old_conf_file = os.path.join(KOLIBRI_HOME, "kolibri_settings.json") if os.path.exists(old_conf_file): if not os.path.exists(conf_file): shutil.move(old_conf_file, conf_file) else: os.remove(old_conf_file)
def setup_logging(debug=False): """ Configures logging in cases where a Django environment is not supposed to be configured. """ # Would be ideal to use the upgrade logic for this, but that is currently # only designed for post-Django initialization tasks. If there are more cases # for pre-django initialization upgrade tasks, we can generalize the logic here if matches_version(get_version(), "<0.12.4"): check_log_file_location() LOGGING = get_base_logging_config(LOG_ROOT) if debug: LOGGING["handlers"]["console"]["level"] = "DEBUG" LOGGING["loggers"]["kolibri"]["level"] = "DEBUG" logging.config.dictConfig(LOGGING)
def check_plugin_config_file_location(version): if matches_version(version, "<0.13.0"): old_conf_file = os.path.join(KOLIBRI_HOME, "kolibri_settings.json") if os.path.exists(old_conf_file): if not os.path.exists(conf_file): shutil.move(old_conf_file, conf_file) migrate_config = ConfigDict() # Migrate from using 'APPS' to 'PLUGINS' as the keys migrate_config.update({ "INSTALLED_PLUGINS": migrate_config.pop("INSTALLED_APPS"), "DISABLED_PLUGINS": migrate_config.pop("DISABLED_APPS"), }) else: os.remove(old_conf_file)
def setup_logging(debug=False, debug_database=False): """ Configures logging in cases where a Django environment is not supposed to be configured. """ # Sets the global DEBUG flag to be picked up in other contexts # (Django settings) OPTIONS["Server"]["DEBUG"] = debug OPTIONS["Server"]["DEBUG_LOG_DATABASE"] = debug_database # Would be ideal to use the upgrade logic for this, but that is currently # only designed for post-Django initialization tasks. If there are more cases # for pre-django initialization upgrade tasks, we can generalize the logic here if matches_version(get_version(), "<0.12.4"): sanity_checks.check_log_file_location() LOGGING = get_base_logging_config(LOG_ROOT, debug=debug, debug_database=debug_database) logging.config.dictConfig(LOGGING)