没有名为'django_python3_ldap'的模块

时间:2018-07-02 20:10:57

标签: python django active-directory ldap

我想使用Active Directory对用户进行身份验证。为了在我的项目中支持此功能,我正在使用框架'django-python3-ldap'。但是,我收到错误ModuleNotFoundError: No module named 'django_python3_ldap'。如果您需要更多信息,请告诉我。

global_settings.py

AUTHENTICATION_BACKENDS = ['django_python3_ldap.auth.LDAPBackend']

setting.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'website', 'django_python3_ldap',
]

# Authentication Backend

AUTHENTICATION_BACKENDS = ('django_python3_ldap.auth.LDAPBackend',)

# Django-Python3-LDAP Authentication

LDAP_AUTH_URL = "ldap://<my_domain>.com:389"

LDAP_AUTH_SEARCH_BASE = "ou=people,dc=<my_domain>,dc=com"

LDAP_AUTH_OBJECT_CLASS = "inetOrgPerson"

LDAP_AUTH_USER_FIELDS = {
    "username": "sAMAccountName",
    "first_name": "givenName",
    "last_name": "sn",
    "email": "mail",
}

LDAP_AUTH_USER_LOOKUP_FIELDS = ("username",)

LDAP_AUTH_CLEAN_USER_DATA = "django_python3_ldap.utils.clean_user_data"

LDAP_AUTH_FORMAT_USERNAME =  "django_python3_ldap.utils.format_username_active_directory"

0 个答案:

没有答案