任何人对活动目录服务器使用 django_auth_ldap
我正在尝试通过 django_auth_ldap 设置身份验证并且遇到问题。如果我从 django 交互式 shell 运行我的身份验证,则身份验证工作正常。来自外壳的示例
>>> from django.contrib.auth import authenticate
>>> authenticate(username='#############',password='*************')
search_s('ou=People, o=hp.com', 2, '(uid=%(user)s)') returned 1 objects: uid=###########,ou=people,o=hp.com
Populating Django ###########
Django user ########## does not have a profile to populate
<User:########## >
但是应用程序视图中的相同代码失败了
Caught LDAPError while authenticating ##########: SERVER_DOWN({'desc': "Can't contact LDAP server"},)