/saml_auth2/acs/ 处的 ModuleNotFoundError

ModuleNotFoundError at /saml_auth2/acs/

我正在使用 Django_Saml2_Auth。我收到以下 error.

ModuleNotFoundError at /saml_auth2/acs/
No module named 'path'

Request Method: POST
https://127.0.0.1:8000/saml_auth2/acs/
3.0.10
ModuleNotFoundError
No module named 'path'
in _find_and_load_unlocked, line 973
/home//workspace//bin/python
3.8.2

使用以下配置:

SAML2_AUTH = {
    # Metadata is required, choose either remote url or local file path
    'METADATA_AUTO_CONF_URL': 'https://login.microsoftonline.com/xxxx-fa3e-43ab-ad2b-d8f26ba34fda/federationmetadata/2007-06/federationmetadata.xml?appid=xx-4dd1-4429-83d4-xxx',
    'METADATA_LOCAL_FILE_PATH': BASE_DIR / 'Dango_Saml_Auth/Azure AD SAML Toolkit.xml',

    # Optional settings below
    'DEFAULT_NEXT_URL': '/admin',  # Custom target redirect URL after the user get logged in. Default to /admin if not set. This setting will be overwritten if you have parameter ?next= specificed in the login URL.
    'CREATE_USER': 'FALSE', # Create a new Django user when a new user logs in. Defaults to True.
    'NEW_USER_PROFILE': {
        'USER_GROUPS': [],  # The default group name when a new user logs in
        'ACTIVE_STATUS': True,  # The default active status for new users
        'STAFF_STATUS': True,  # The staff status for new users
        'SUPERUSER_STATUS': False,  # The superuser status for new users
    },
    'ATTRIBUTES_MAP': {
        'email': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress',
        'username': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name',
        'first_name': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname',
        'last_name': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname',
    },
    # 'TRIGGER': {
    # 'CREATE_USER': 'path.to.your.new.user.hook.method',
    # 'BEFORE_LOGIN': 'path.to.your.login.hook.method',
    # },
    'ASSERTION_URL': 'https://127.0.0.1:8000', # Custom URL to validate incoming SAML requests against
    'ENTITY_ID': 'http://samltoolkit/xxxxx-437a-430e-a63a-125f2c210e52', # Populates the Issuer element in authn request
    'NAME_ID_FORMAT': 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', # Sets the Format property of authn NameIDPolicy element
    'USE_JWT': False, # Set this to True if you are running a Single Page Application (SPA) with Django Rest Framework (DRF), and are using JWT authentication to authorize client users
    'FRONTEND_URL': 'https://localhost:4200', # Redirect URL for the client if you are using JWT auth with DRF. See explanation below
}

我不知道我的代码有什么问题。已根据提到的文档配置 urls 文件。

要解决此问题,请将设置更改为 'CREATE_USER': 'True'