示例#1
0
def static_finders_changed(**kwargs):
    if kwargs['setting'] in {
        'STATICFILES_DIRS',
        'STATIC_ROOT',
    }:
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()
示例#2
0
def update_installed_apps(**kwargs):
    if kwargs['setting'] == 'INSTALLED_APPS':
        # Rebuild any AppDirectoriesFinder instance.
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()
        # Rebuild app_template_dirs cache.
        from django.template.loaders import app_directories as mod
        mod.app_template_dirs = mod.calculate_app_template_dirs()
示例#3
0
def reload_apps():
    import django
    from django.contrib.staticfiles.finders import get_finder
    # Clear cache for any AppDirectoriesFinder instance.
    # This should be done before Django apps is reloaded.
    get_finder.cache_clear()

    _KNOWN_SETTINGS.clear()
    django.apps.apps.app_configs.clear()
    django.apps.apps.ready = False
    django.setup()
示例#4
0
def update_installed_apps(**kwargs):
    if kwargs['setting'] == 'INSTALLED_APPS':
        # Rebuild any AppDirectoriesFinder instance.
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()
        # Rebuild management commands cache
        from django.core.management import get_commands
        get_commands.cache_clear()
        # Rebuild get_app_template_dirs cache.
        from django.template.utils import get_app_template_dirs
        get_app_template_dirs.cache_clear()
        # Rebuild translations cache.
        from django.utils.translation import trans_real
        trans_real._translations = {}
示例#5
0
def update_installed_apps(**kwargs):
    if kwargs['setting'] == 'INSTALLED_APPS':
        # Rebuild any AppDirectoriesFinder instance.
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()
        # Rebuild app_template_dirs cache.
        from django.template.loaders import app_directories as mod
        mod.app_template_dirs = mod.calculate_app_template_dirs()
        # Rebuild templatetags module cache.
        from django.template import base
        base.templatetags_modules[:] = []
        # Rebuild management commands cache
        from django.core.management import get_commands
        get_commands.cache_clear()
示例#6
0
文件: signals.py 项目: robpal/django
def update_installed_apps(**kwargs):
    if kwargs['setting'] == 'INSTALLED_APPS':
        # Rebuild any AppDirectoriesFinder instance.
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()
        # Rebuild management commands cache
        from django.core.management import get_commands
        get_commands.cache_clear()
        # Rebuild templatetags module cache.
        from django.template.base import get_templatetags_modules
        get_templatetags_modules.cache_clear()
        # Rebuild get_app_template_dirs cache.
        from django.template.utils import get_app_template_dirs
        get_app_template_dirs.cache_clear()
        # Rebuild translations cache.
        from django.utils.translation import trans_real
        trans_real._translations = {}
示例#7
0
文件: signals.py 项目: Gautier/django
def update_installed_apps(**kwargs):
    if kwargs["setting"] == "INSTALLED_APPS":
        # Rebuild any AppDirectoriesFinder instance.
        from django.contrib.staticfiles.finders import get_finder

        get_finder.cache_clear()
        # Rebuild management commands cache
        from django.core.management import get_commands

        get_commands.cache_clear()
        # Rebuild templatetags module cache.
        from django.template import base as mod

        mod.templatetags_modules = []
        # Rebuild app_template_dirs cache.
        from django.template.loaders import app_directories as mod

        mod.app_template_dirs = mod.calculate_app_template_dirs()
        # Rebuild translations cache.
        from django.utils.translation import trans_real

        trans_real._translations = {}
示例#8
0
        'STATICFILES_STORAGE',
        'STATIC_ROOT',
        'STATIC_URL',
    }:
        from django.contrib.staticfiles.storage import staticfiles_storage
        staticfiles_storage._wrapped = empty


@receiver(setting_changed)
def static_finders_changed(**kwargs):
    if kwargs['setting'] in {
        'STATICFILES_DIRS',
        'STATIC_ROOT',
    }:
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()


@receiver(setting_changed)
def auth_password_validators_changed(**kwargs):
    if kwargs['setting'] == 'AUTH_PASSWORD_VALIDATORS':
        from django.contrib.auth.password_validation import get_default_password_validators
        get_default_password_validators.cache_clear()


@receiver(setting_changed)
def user_model_swapped(**kwargs):
    if kwargs['setting'] == 'AUTH_USER_MODEL':
        apps.clear_cache()
        try:
            from django.contrib.auth import get_user_model
示例#9
0
def static_finders_changed(**kwargs):
    if kwargs["setting"] in {"STATICFILES_DIRS", "STATIC_ROOT"}:
        from django.contrib.staticfiles.finders import get_finder

        get_finder.cache_clear()
示例#10
0
def update_installed_apps(**kwargs):
    if kwargs['setting'] == 'INSTALLED_APPS':
        # Rebuild any AppDirectoriesFinder instance.
        from django.contrib.staticfiles.finders import get_finder
        get_finder.cache_clear()
示例#11
0
文件: signals.py 项目: kofic/django
def static_finders_changed(**kwargs):
    if kwargs["setting"] in {"STATICFILES_DIRS", "STATIC_ROOT"}:
        from django.contrib.staticfiles.finders import get_finder

        get_finder.cache_clear()
示例#12
0
import os