<bdo id='WwnRn'></bdo><ul id='WwnRn'></ul>
    <i id='WwnRn'><tr id='WwnRn'><dt id='WwnRn'><q id='WwnRn'><span id='WwnRn'><b id='WwnRn'><form id='WwnRn'><ins id='WwnRn'></ins><ul id='WwnRn'></ul><sub id='WwnRn'></sub></form><legend id='WwnRn'></legend><bdo id='WwnRn'><pre id='WwnRn'><center id='WwnRn'></center></pre></bdo></b><th id='WwnRn'></th></span></q></dt></tr></i><div id='WwnRn'><tfoot id='WwnRn'></tfoot><dl id='WwnRn'><fieldset id='WwnRn'></fieldset></dl></div>

      <tfoot id='WwnRn'></tfoot>

      1. <small id='WwnRn'></small><noframes id='WwnRn'>

        <legend id='WwnRn'><style id='WwnRn'><dir id='WwnRn'><q id='WwnRn'></q></dir></style></legend>

        django-auth-ldap 安装不工作

        时间:2023-07-24
        • <small id='nMMCt'></small><noframes id='nMMCt'>

        • <tfoot id='nMMCt'></tfoot>

          • <legend id='nMMCt'><style id='nMMCt'><dir id='nMMCt'><q id='nMMCt'></q></dir></style></legend>
            <i id='nMMCt'><tr id='nMMCt'><dt id='nMMCt'><q id='nMMCt'><span id='nMMCt'><b id='nMMCt'><form id='nMMCt'><ins id='nMMCt'></ins><ul id='nMMCt'></ul><sub id='nMMCt'></sub></form><legend id='nMMCt'></legend><bdo id='nMMCt'><pre id='nMMCt'><center id='nMMCt'></center></pre></bdo></b><th id='nMMCt'></th></span></q></dt></tr></i><div id='nMMCt'><tfoot id='nMMCt'></tfoot><dl id='nMMCt'><fieldset id='nMMCt'></fieldset></dl></div>

                • <bdo id='nMMCt'></bdo><ul id='nMMCt'></ul>
                    <tbody id='nMMCt'></tbody>

                  本文介绍了django-auth-ldap 安装不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在我的 Windows 系统中安装 django-auth-ldap 它显示以下错误

                  I am trying to install django-auth-ldap in my windows system it shows the following error

                  pip-build-3x6rkxb4pyldapmoduleserrors.h(8):致命错误 C1083:无法打开包含文件:'lber.h':没有这样的文件或目录错误:命令 'C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe' 失败,退出状态为 2

                  pip-build-3x6rkxb4pyldapmoduleserrors.h(8): fatal error C1083: Cannot open include file: 'lber.h': No such file or directory error: command 'C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe' failed with exit status 2

                  # LDAP auth settings.
                  LDAP_AUTH_URL = os.environ.get("LDAP_AUTH_URL", "ldap://xxx.xx.xx.xx:389")
                  LDAP_AUTH_USE_TLS = False
                  
                  LDAP_AUTH_SEARCH_BASE = "dc=maxcrc,dc=com" 
                  LDAP_AUTH_OBJECT_CLASS = "inetOrgPerson"
                  LDAP_AUTH_USER_FIELDS = {
                      "username": "uid",
                      "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_SYNC_USER_RELATIONS = "django_python3_ldap.utils.sync_user_relations"
                  LDAP_AUTH_FORMAT_SEARCH_FILTERS = "django_python3_ldap.utils.format_search_filters"
                  LDAP_AUTH_FORMAT_USERNAME = "django_python3_ldap.utils.format_username_openldap"
                  LDAP_AUTH_ACTIVE_DIRECTORY_DOMAIN = None 
                  LDAP_AUTH_CONNECTION_USERNAME = "cn=Manager,dc=maxcrc,dc=com" 
                  LDAP_AUTH_CONNECTION_PASSWORD = "*****" 
                  
                  LDAP_AUTH_CONNECT_TIMEOUT = None
                  LDAP_AUTH_RECEIVE_TIMEOUT = None
                  
                  AUTHENTICATION_BACKENDS = (
                      "django_python3_ldap.auth.LDAPBackend",
                  )
                  

                  我的版本是Python - 3.6.3(64 位)Django - 1.11.6(64位)Windows 10 - 64 位

                  My versions are Python - 3.6.3 (64bit) Django - 1.11.6 (64bit) Windows 10 - 64bit

                  谢谢

                  推荐答案

                  django-auth-ldap 由于依赖关系,需要编译.特别是在 Windows 上,我建议尝试纯 Python 解决方案.我使用的非常好用的是 django-python3-ldap,你可以在这里找到:

                  django-auth-ldap needs to be compiled due to its dependencies. Especially on Windows, I'd recommend trying a pure Python solution. The one I use which works very well, is django-python3-ldap, which you can find here:

                  https://github.com/etianen/django-python3-ldap

                  这是我设置设置的方式,以便我们也可以直接使用这些值与 ldap3 进行连接:

                  Here is how I set up the settings, so that we can connect using these values with ldap3 directly as well:

                  AUTHENTICATION_BACKENDS = [
                      'django.contrib.auth.backends.ModelBackend',
                      'django_python3_ldap.auth.LDAPBackend',
                  ]
                  
                  # LDAP Connection Settings
                  LDAP_AUTH_HOST = 'ldap.example.com'
                  LDAP_AUTH_PORT = 636
                  LDAP_AUTH_URL = 'ldaps://{host}:{port}'.format(
                      host=LDAP_AUTH_HOST,
                      port=LDAP_AUTH_PORT,
                  )
                  LDAP_AUTH_CONNECTION_USERNAME = 'ldapuser'
                  LDAP_AUTH_CONNECTION_PASSWORD = 'ldappassword'
                  
                  # Initiate TLS on connection.
                  LDAP_AUTH_USE_TLS = True
                  
                  # The LDAP search base for looking up users.
                  LDAP_AUTH_SEARCH_BASE = "ou=People,dc=example,dc=com"
                  
                  # The LDAP class that represents a user.
                  LDAP_AUTH_OBJECT_CLASS = "shadowAccount"
                  
                  # User model fields mapped to the LDAP
                  # attributes that represent them.
                  LDAP_AUTH_USER_FIELDS = {
                      "username": "uid",
                  }
                  
                  # A tuple of fields used to uniquely identify a user.
                  LDAP_AUTH_USER_LOOKUP_FIELDS = ("username",)
                  

                  自述文件还包括有关 Active Directory 的说明(如果您要连接到该目录).祝你好运!

                  The README also includes instructions for Active Directory, if that's what you're connecting to. Good luck!

                  这篇关于django-auth-ldap 安装不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:了解 Django-LDAP 身份验证 下一篇:如何在 Ubuntu 的 virtualenv 中安装 python-ldap?

                  相关文章

                    <legend id='lT6v8'><style id='lT6v8'><dir id='lT6v8'><q id='lT6v8'></q></dir></style></legend>
                    1. <small id='lT6v8'></small><noframes id='lT6v8'>

                        <bdo id='lT6v8'></bdo><ul id='lT6v8'></ul>
                    2. <tfoot id='lT6v8'></tfoot>

                      <i id='lT6v8'><tr id='lT6v8'><dt id='lT6v8'><q id='lT6v8'><span id='lT6v8'><b id='lT6v8'><form id='lT6v8'><ins id='lT6v8'></ins><ul id='lT6v8'></ul><sub id='lT6v8'></sub></form><legend id='lT6v8'></legend><bdo id='lT6v8'><pre id='lT6v8'><center id='lT6v8'></center></pre></bdo></b><th id='lT6v8'></th></span></q></dt></tr></i><div id='lT6v8'><tfoot id='lT6v8'></tfoot><dl id='lT6v8'><fieldset id='lT6v8'></fieldset></dl></div>