Commit 7316661e authored by ibuler's avatar ibuler

[Update] 启动加载common setting

parent f6056426
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
import ldap
from django.dispatch import receiver from django.dispatch import receiver
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.conf import settings from django.conf import settings
from django_auth_ldap.config import LDAPSearch from django.db.utils import ProgrammingError, OperationalError
from .models import Setting from .models import Setting
from .utils import get_logger from .utils import get_logger
...@@ -25,7 +24,10 @@ def refresh_settings_on_changed(sender, instance=None, **kwargs): ...@@ -25,7 +24,10 @@ def refresh_settings_on_changed(sender, instance=None, **kwargs):
def refresh_all_settings_on_django_ready(sender, **kwargs): def refresh_all_settings_on_django_ready(sender, **kwargs):
logger.debug("Receive django ready signal") logger.debug("Receive django ready signal")
logger.debug(" - fresh all settings") logger.debug(" - fresh all settings")
try:
Setting.refresh_all_settings() Setting.refresh_all_settings()
except (ProgrammingError, OperationalError):
pass
@receiver(ldap_auth_enable, dispatch_uid="my_unique_identifier") @receiver(ldap_auth_enable, dispatch_uid="my_unique_identifier")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment