您在尝试添加
时收到AssertionError
ACCOUNT_USERNAME_VALIDATORS =
('allauth.socialaccount.providers.battlenet.validators.BattletagUsernameValidator',)
当它是一个列表时也是如此,如果我只添加str,我收到ACCOUNT_USERNAME_VALIDATORS
必须是列表的错误
其他allauth配置
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_EMAIL_REQUIRED=True
ACCOUNT_EMAIL_VERIFICATION = "optional"
ACCOUNT_LOGIN_ATTEMPTS_LIMIT =5
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT =300
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 5
LOGIN_REDIRECT_URL = "/"
ACCOUNT_USERNAME_MIN_LENGTH = 3
答案 0 :(得分:1)
如果没有更多的背景,您的问题可能与以下内容有关: https://github.com/pennersr/django-allauth/pull/1648
链接问题中提出的解决方案是:
# Use a string in settings
ACCOUNT_USERNAME_VALIDATORS = 'foobar.validators.username_validators'
# Return a list in the validators
def username_validators():
return [
socialaccount.providers.battlenet.validators.BattletagUsernameValidator,
]