django allauth为';账户确认电子邮件';带参数';()';和关键字参数';{}';找不到

django allauth为';账户确认电子邮件';带参数';()';和关键字参数';{}';找不到,django,django-allauth,django-rest-auth,Django,Django Allauth,Django Rest Auth,我正在使用django allauth和django rest auth 以下是stacktrace: [2016-02-15 23:45:35,093] ERROR [base:handle_uncaught_exception:256 8977] Internal Server Error: /api/rest-auth/registration/ Traceback (most recent call last):

我正在使用django allauth和django rest auth

以下是stacktrace:

[2016-02-15 23:45:35,093] ERROR [base:handle_uncaught_exception:256 8977] Internal Server Error: /api/rest-auth/registration/
Traceback (most recent call last):                                              
  File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)     
  File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)                                           
  File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)                              
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_framework/views.py", line 452, in dispatch
    response = self.handle_exception(exc)                                       
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_framework/views.py", line 449, in dispatch
    response = handler(request, *args, **kwargs)                                
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_auth/registration/views.py", line 44, in post
    self.form_valid(self.form)                                                  
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_auth/registration/views.py", line 36, in form_valid
    self.get_success_url())                                                     
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/allauth/account/utils.py", line 157, in complete_signup
    signal_kwargs=signal_kwargs)                                                
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/allauth/account/utils.py", line 114, in perform_login
    send_email_confirmation(request, user, signup=signup)                       
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/allauth/account/utils.py", line 286, in send_email_confirmation
    signup=signup)                                                              
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/allauth/account/models.py", line 60, in send_confirmation
    confirmation.send(request, signup=signup)                                   
  File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/allauth/account/models.py", line 121, in send
    activate_url = reverse("account_confirm_email", args=[self.key])            
  File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/core/urlresolvers.py", line 578, in reverse
    return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/core/urlresolvers.py", line 495, in _reverse_with_prefix
    (lookup_view_s, args, kwargs, len(patterns), patterns))                     
NoReverseMatch: Reverse for 'account_confirm_email' with arguments '(u'vgro7mdagterfbnqxlkihpnzs2bsp1iktwxng9vecznpeg8hcdv1eidco11tee3u',)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
allauth的我的URL

在我的应用程序“api”中:

api/url.py

...
url(r'^accounts/', include('allauth.urls')),
url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$',confirm_email, name='confirm_email'),
url(r'^rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
...
此外,根据,帐户确认电子邮件应在您的视图中被覆盖,这就是我覆盖url的原因:

url(r'^account-confirm-email/(?P<key>\w+)/$', TemplateView.as_view(),
    name='account_confirm_email'),
url(r'^account confirm email/(?P\w+)/$),TemplateView.as\u view(),
name='account\u confirm\u email'),
使用我的url:

url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$',       confirm_email, name='confirm_email'), 
url(r'^rest auth/registration/account confirm email/(?P\w+)/$),confirm_email,name='confirm_email'),
这里还有一个类似的问题:

但这个问题是因为名称空间,而在my urls.py中,我没有为allauth URL命名


任何关于我做错了什么的建议。

您好,我决定使用RedirectView.as_view(),用这个简单的方法在您的URL.py上写下

from django.views.generic import RedirectView
url(r'^verifyemail/(?P<key>\w+)$', RedirectView.as_view(url='/', permanent=True), name='account_confirm_email')
来自django.views.generic导入重定向视图的

url(r'^verifyemail/(?P\w+)$,重定向视图。作为视图(url='/',permanent=True),name='account'\u confirm\u email')

这将在主页上重定向,并将文章从Angular service发送到rest“rest\u register”模式。

你有没有想过?下面的答案有用吗?我在同样的情况下犯了同样的错误。您添加的URL似乎是预期的,也在本期github中提到过:,但当我以同样的方式覆盖它时,我也遇到了这个错误。
url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$',       confirm_email, name='confirm_email'), 
from django.views.generic import RedirectView
url(r'^verifyemail/(?P<key>\w+)$', RedirectView.as_view(url='/', permanent=True), name='account_confirm_email')