I am using django-allauth along with django rest-auth.
here is the 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: []
My urls for allauth
within my app "api":
api/urls.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')),
...
this is within an app named "api" within my project.
Using a shell I see:
python manage.py shell
Inside api.apps.ApiConfig.ready
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.urlresolvers import reverse
>>>
>>> reverse('account_confirm_email', args=['l8ig7wqo1l4ypd7uosuoxlgnv2qxf5voe5ehwcd7s46hbprzyx9qwjgeontw5un6'])
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/divkis01/webapps/instaguide_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/divkis01/webapps/instaguide_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 '('l8ig7wqo1l4ypd7uosuoxlgnv2qxf5voe5ehwcd7s46hbprzyx9qwjgeontw5un6',)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
>>>
while if I use api:account_confirm_email, it does return correct url.
>>> reverse('api:account_confirm_email', args=['l8ig7wqo1l4ypd7uosuoxlgnv2qxf5voe5ehwcd7s46hbprzyx9qwjgeontw5un6'])
u'/api/rest-auth/registration/account-confirm-email/l8ig7wqo1l4ypd7uosuoxlgnv2qxf5voe5ehwcd7s46hbprzyx9qwjgeontw5un6/'
Also as per rest-auth FAQs, the account-confirm-email should be overridden in your views, which is why I override the url:
url(r'^account-confirm-email/(?P<key>\w+)/$', TemplateView.as_view(),
name='account_confirm_email'),
with my url:
url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$', confirm_email, name='confirm_email'),
There is another similar question here: django-allauth returns error "Reverse ... with arguments '()' and keyword arguments '{}' not found"
but that problem is because of namespacing, while in my urls.py I do not namespace the allauth urls.
Any suggestions what I am doing wrong.