Я использую Django rest auth для аутентификации пользователей в моем приложении, пользователи успешно получают электронное письмо для подтверждения своей учетной записи, но при нажатии на ссылку они получают ошибку
KeyError at /account-confirm-email/MTU:1iNTcO:lRoljcqAs3HQMlyy9AzUJH6Kq5w/
Пожалуйста, как можнопользователи будут успешно проверены, когда они нажмут на ссылку
my settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
'rest_auth.registration',
'allauth',
'allauth.account',
'users',
]
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 1
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 86400 # 1 day in seconds
ACCOUNT_LOGOUT_REDIRECT_URL ='/accounts/login/'
LOGIN_REDIRECT_URL = '/accounts/profile'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'test@gmail.com'
EMAIL_HOST_PASSWORD = 'testE'
DEFAULT_FROM_EMAIL = 'test@gmail.com'
DEFAULT_TO_EMAIL = EMAIL_HOST_USER
EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = '/
urls.py
from rest_auth.registration.views import VerifyEmailView
urlpatterns = [
path('admin/', admin.site.urls),
url('api/rest-auth/', include('rest_auth.urls')),
url('api/account/', include('users.api.urls')),
url('api/rest-auth/registration/', include('rest_auth.registration.urls')),
re_path(r'^account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'),
re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'),
]
[обновить] обновленную трассировку после реализациирешение
Traceback:
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\core\handlers\base.py" in _get_response
145. response = self.process_exception_by_middleware(e, request)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\core\handlers\base.py" in _get_response
143. response = response.render()
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\response.py" in render
106. self.content = self.rendered_content
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\response.py" in rendered_content
83. content = template.render(context, self._request)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\backends\django.py" in render
61. return self.template.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render
171. return self._render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in _render
163. return self.nodelist.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render
937. bit = node.render_annotated(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render_annotated
904. return self.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\loader_tags.py" in render
150. return compiled_parent._render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in _render
163. return self.nodelist.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render
937. bit = node.render_annotated(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render_annotated
904. return self.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\loader_tags.py" in render
150. return compiled_parent._render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in _render
163. return self.nodelist.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render
937. bit = node.render_annotated(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render_annotated
904. return self.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\loader_tags.py" in render
62. result = block.nodelist.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render
937. bit = node.render_annotated(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render_annotated
904. return self.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\defaulttags.py" in render
309. return nodelist.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render
937. bit = node.render_annotated(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\base.py" in render_annotated
904. return self.render(context)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\template\defaulttags.py" in render
443. url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\urls\base.py" in reverse
90. return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "D:\Opeodedeyi\Documents\Django\WORK IN PROGRESS\ProfilesAPI\venv\lib\site-packages\django\urls\resolvers.py" in _reverse_with_prefix
673. raise NoReverseMatch(msg)
Exception Type: NoReverseMatch at /account-confirm-email/MTk:1iNcyz:wyyIWJiSWJ2s9JHabdympHnzbMU/
Exception Value: Reverse for 'account_email' not found. 'account_email' is not a valid view function or pattern name.