Django Allauth TypeError at /accounts/confirm-email/



我使用django-allauth进行django身份验证确认电子邮件时,我收到

TypeError at /accounts/confirmemail/MQ:1mk57U:HtWDA8B5NClWhK2L6nDxJgwlNRGItW_4FyhDqcbcfow/和它抱怨argument of type 'bool' is not iterable

在我搜索的过程中,答案是使用django-rest-allauth的原因,而在这里我没有使用任何rest api并面临这个问题。

我的settings.py文件上的一些配置

# all auth config
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",
]
SITE_ID = 1
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_LOGIN_ON_PASSWORD_RESET = True

更新:完整的错误跟踪看起来是

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/confirm-email/MQ:1mk57U:HtWDA8B5NClWhK2L6nDxJgwlNRGItW_4FyhDqcbcfow/
Django Version: 3.2.9
Python Version: 3.9.7
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.twitter',
'allauth.socialaccount.providers.telegram',
'allauth.socialaccount.providers.instagram',
'django_extensions',
'avatar',
'django_cleanup.apps.CleanupConfig',
'user']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
File "/home/ali/.local/lib/python3.9/site-packages/django/shortcuts.py", line 130, in resolve_url
return reverse(to, args=args, kwargs=kwargs)
File "/home/ali/.local/lib/python3.9/site-packages/django/urls/base.py", line 86, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
File "/home/ali/.local/lib/python3.9/site-packages/django/urls/resolvers.py", line 694, in _reverse_with_prefix
raise NoReverseMatch(msg)
During handling of the above exception (Reverse for 'True' not found. 'True' is not a valid view function or pattern name.), another exception occurred:
File "/home/ali/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/ali/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ali/.local/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/home/ali/.local/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/home/ali/.local/lib/python3.9/site-packages/allauth/account/views.py", line 295, in get
return self.post(*args, **kwargs)
File "/home/ali/.local/lib/python3.9/site-packages/allauth/account/views.py", line 334, in post
return redirect(redirect_url)
File "/home/ali/.local/lib/python3.9/site-packages/django/shortcuts.py", line 41, in redirect
return redirect_class(resolve_url(to, *args, **kwargs))
File "/home/ali/.local/lib/python3.9/site-packages/django/shortcuts.py", line 136, in resolve_url
if '/' not in to and '.' not in to:
Exception Type: TypeError at /accounts/confirm-email/MQ:1mk57U:HtWDA8B5NClWhK2L6nDxJgwlNRGItW_4FyhDqcbcfow/
Exception Value: argument of type 'bool' is not iterable

问题来自电子邮件确认完成后的反向url无效,因此您需要转到您的设置并检查设置。您必须在确认后为其提供有效的url才能重新排序所以我希望修改网址

相关内容

最新更新