在/ rest-auth / registration / account-confirm-email中配置不正确 [英] ImproperlyConfigured at /rest-auth/registration/account-confirm-email
问题描述
我正在使用 django-rest-auth 进行用户注册和验证邮件。
我可以在用户注册后成功发送电子邮件。但是,在电子邮件验证中,出现以下回溯错误:
I'm using django-rest-auth for user signup and verify email. I'm able to successfully send the email when a user signs up. Howvever, on email verification, I'm getting this error with the following traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in get
155. return self.render_to_response(context)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in render_to_response
130. template=self.get_template_names(),
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in get_template_names
142. "TemplateResponseMixin requires either a definition of "
Exception Type: ImproperlyConfigured at /rest-auth/registration/account-confirm-email/vjohhnrf6xpkmn1jxbzaopdn0g79tdyofumeeuyuehcuja8slyz7nzq1idyifcqk/
Exception Value: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
关于 template_name的定义或 get_template_names()的实现解决此问题吗?
Any idea on how to fix this ?
推荐答案
使用确认电子邮件时,有两种方法可以解决此问题。
When you use confirmation email you have two ways to do it.
使用API指定或创建您的API。默认情况下,它使用django-allauth,并且可以使用反向的TemplateView。
Using the specified by the API or creating yours. By default it uses django-allauth and a TemplateView on reverse can be used.
如果创建自己的帐户,则可能必须覆盖account_confirm_email,然后发布到Verification_mail。
If you create yours, you may have to override account_confirm_email and then post to verification_mail.
在url中。 py它的定义恰好相反,因此,根据您要尝试执行的操作,您将必须首先创建自己的account_confirm_email,获取所需的密钥并将其发布到verify-email。 此处有关此错误的更多信息。
In urls.py it is defined just reverse so, depending on what you are trying to do you will have first to create your own account_confirm_email, get the required key and post it to verify-email. Here there is more information about this bug.
这篇关于在/ rest-auth / registration / account-confirm-email中配置不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!