def django_auth_setup():
    global DJANGO_AUTH_CLASS

    if DJANGO_AUTH_CLASS is not None:
        return

    # Versions 1.7 and later of Django don't pull models until
    # they are needed.  When using framework facilities outside the
    # web application container we need to run django.setup() to
    # get the model definitions cached.
    if '^model' in __opts__['external_auth']['django']:
        django_model_fullname = __opts__['external_auth']['django']['^model']
        django_model_name = django_model_fullname.split('.')[-1]
        django_module_name = '.'.join(django_model_fullname.split('.')[0:-1])

        __import__(django_module_name, globals(), locals(), 'SaltExternalAuthModel')
        DJANGO_AUTH_CLASS_str = 'django_auth_module.{0}'.format(django_model_name)
        DJANGO_AUTH_CLASS = eval(DJANGO_AUTH_CLASS_str)  # pylint: disable=W0123

    if django.VERSION >= (1, 7):
        django.setup()
Prepare the connection to the Django authentication framework
dataset/ETHPy150Open saltstack/salt/salt/auth/django.py/django_auth_setup