Django ldap模块错误“AttributeError:module'ldap'没有属性'OPT_X_TLS_REQUIRE_CERT'”

时间:2017-12-21 18:06:02

标签: python django python-3.x ldap

我尝试启动我的Django项目,但我发现了这个错误:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/erastov/PycharmProjects/auction/auc_env/lib/python3.5/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/erastov/PycharmProjects/auction/auc_env/lib/python3.5/site-packages/django/core/management/__init__.py", line 308, in execute
    settings.INSTALLED_APPS
  File "/home/erastov/PycharmProjects/auction/auc_env/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/erastov/PycharmProjects/auction/auc_env/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/erastov/PycharmProjects/auction/auc_env/lib/python3.5/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/erastov/PycharmProjects/auction/auction/backend/auction/settings/dev.py", line 1, in <module>
    from .base import *
  File "/home/erastov/PycharmProjects/auction/auction/backend/auction/settings/base.py", line 86, in <module>
    ldap.OPT_X_TLS_REQUIRE_CERT: ldap.OPT_X_TLS_NEVER
AttributeError: module 'ldap' has no attribute 'OPT_X_TLS_REQUIRE_CERT'

我使用Python 3.5,Django 1.11.7,ldap 1.0.2

当我删除我的本地项目并再次从github克隆时,就会发生这种情况。我像往常一样安装了所有要求。

部分代码:

import os

import ldap
from django_auth_ldap.config import LDAPSearch, ActiveDirectoryGroupType

....

AUTH_LDAP_GLOBAL_OPTIONS = {
    ldap.OPT_X_TLS_REQUIRE_CERT: ldap.OPT_X_TLS_NEVER
}

0 个答案:

没有答案