TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
网址:
from allauth.account.views import confirm_email as allauthemailconfirmation
url(r'^rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$', allauthemailconfirmation, name="account_confirm_email"),
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
我刚看过this,但我不明白如何修改我的代码
回溯:
ImproperlyConfigured: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
Internal Server Error: /rest-auth/registration/account-confirm-email/MTU:1bn1OD:dQ_mCYi6Zpr8h2aKS9J9BvNdDjA/
Traceback (most recent call last):
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 159, in get
return self.render_to_response(context)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 133, in render_to_response
template=self.get_template_names(),
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 146, in get_template_names
"TemplateResponseMixin requires either a definition of "
ImproperlyConfigured: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
Internal Server Error: /rest-auth/registration/account-confirm-email/MTU:1bn1OD:dQ_mCYi6Zpr8h2aKS9J9BvNdDjA/
Traceback (most recent call last):
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 159, in get
return self.render_to_response(context)
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 133, in render_to_response
template=self.get_template_names(),
File "/home/k/klimaku9/justforfree.ru/public_html/venv/lib/python2.7/site-packages/django/views/generic/base.py", line 146, in get_template_names
"TemplateResponseMixin requires either a definition of "
ImproperlyConfigured: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
答案 0 :(得分:1)
您的正则表达式(?P<key>\w+)
应该类似于(?P<key>.+)
。