Skip to content

Regression in 7.0.1 causes ImproperlyConfigured error for account-email-verification-sent endpoint (maybe others) #675

Open
@vhsantos

Description

@vhsantos

Description

After upgrading from version 7.0.0 to 7.0.1 of dj-rest-auth, the account-email-verification-sent endpoint raises the following error:

ImproperlyConfigured at /api/auth/registration/account-email-verification-sent
TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
Request Method:	GET
Request URL:	http://0.0.0.0:8000/api/auth/registration/account-email-verification-sent
Django Version:	5.0.10
Exception Type:	ImproperlyConfigured
Exception Value:
TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
Exception Location:	my_app/.venv/lib/python3.12/site-packages/django/views/generic/base.py, line 212, in get_template_names
Raised during:	django.views.generic.base.TemplateView
Python Executable:	my_app/.venv/bin/python
Python Version:	3.12.3

I believe that this issue is exposed due to a change in the URL definition for the endpoint in version 7.0.1 (PR #667) by @alexandrebarbaruiva

In version 7.0.0, the URL pattern for this endpoint was defined as:

re_path('account-email-verification-sent/', TemplateView.as_view()),

In version 7.0.1, this was changed to:

re_path(r'account-email-verification-sent/?$', TemplateView.as_view()),

Workaround

This issue can be temporarily resolved by rolling back to version 7.0.0.

Related Issues

This regression is similar to another issue introduced in version 7.0.1 reported in the issue #673

Environment

Django Version: 5.0.10
Python Version: 3.12.3
dj-rest-auth Version: 7.0.1

My relevant urls.py code:

from allauth.account.views import ConfirmEmailView, EmailVerificationSentView
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from django.views import defaults as default_views
from django.views.generic import TemplateView
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from rest_framework.authtoken.views import obtain_auth_token

[...]

# API URLS
urlpatterns += [
    # API base url
    path("api/", include("api.urls")),
    # DRF auth token
    path("api/auth/", include("dj_rest_auth.urls")),
    path(
        "api/auth/registration/account-confirm-email/<str:key>/",
        ConfirmEmailView.as_view(),
        name="account_confirm_email",
    ),
    path(
        "api/auth/registration/account-email-verification-sent/",
        EmailVerificationSentView.as_view(),
        name="account_email_verification_sent",
    ),
    path("api/auth/registration/", include("dj_rest_auth.registration.urls")),
    path("auth-token/", obtain_auth_token),
    path("api/schema/", SpectacularAPIView.as_view(), name="api-schema"),
    path("api/docs/", SpectacularSwaggerView.as_view(url_name="api-schema"), name="api-docs"),
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions