Home > Back-end >  Django Allauth TypeError at /accounts/confirm-email/
Django Allauth TypeError at /accounts/confirm-email/

Time:11-09

I'm using django-allauth for my django authentication and while confirming the email i get

TypeError at /accounts/confirmemail/MQ:1mk57U:HtWDA8B5NClWhK2L6nDxJgwlNRGItW_4FyhDqcbcfow/ and it's complaining about argument of type 'bool' is not iterable

as I searched answers were in the cause of using django-rest-allauth and here I'm not using any rest api and facing this issue.

some configs on my settings.py file

# 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

Update: The full error tracback looks

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

CodePudding user response:

The proplem come from after email confirmation done the reverse url is not valid so you need to go to your setting and check setting for that you must give it valid url to be redircted after confirmation So I hope to revise the urls

  • Related