title: Django REST auth: error rendering django-allauth template after email confirmation
body: <p>I'm using a Django REST Framework API to communicate from my AngularJS frontend to the Django backend, which is working really well. I installed the super helpful django-rest-auth package as well as their optional registration add on. Authentication works, and registration mostly works as well.</p>
  
  <p>My problem is that the confirmation link in the confirmation email sent to the new user gives me a NoReverseMatch error. Thanks to the django-rest-auth <a href="http://django-rest-auth.readthedocs.io/en/latest/faq.html" rel="nofollow noreferrer">FAQ</a>, I know the confirmation doesn't work by default and requires overriding but I mirrored what the poster of <a href="https://github.com/Tivix/django-rest-auth/issues/104" rel="nofollow noreferrer">this</a> question did. My urls:</p>
  
  <pre><code>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&lt;key&gt;\w+)/$', allauthemailconfirmation, name="account_confirm_email"),
  url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
  ...
  </code></pre>
  
  <p>And the exact error:</p>
  
  <pre><code>NoReverseMatch at /rest-auth/registration/account-confirm-email/ahhuvpetqmcsd6hjlgrjuru11mwfkpk9sljmfbuprxwz8elnajabr84vusnmdw7r/
  Reverse for 'account_email' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
  </code></pre>
  
  <p>The poster of <a href="https://stackoverflow.com/questions/35418428/django-allauth-returns-error-reverse-for-account-confirm-email-with-arguments">this</a> question seems to have had the same issue, though I don't understand how the one answer applies, and it's not accepted, so I'm not sure if it even works.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>Based on the first comment below, I tried changing the URL name to <code>account_email</code>. This still resulted in an error, but after re-reading the error, I realized it's thrown during render of a default <code>django-allauth</code> template, after the allauth view has handled the confirmation:</p>
  
  <pre><code>Error during template rendering
  
  In template C:\Python34\lib\site-packages\allauth\templates\base.html, error at line 26
  Reverse for 'account_email' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
      16      &lt;li&gt;{{message}}&lt;/li&gt;
  17      {% endfor %}
  18        &lt;/ul&gt;
  19      &lt;/div&gt;
  20      {% endif %}
  21  
  22      &lt;div&gt;
  23        &lt;strong&gt;Menu:&lt;/strong&gt;
  24        &lt;ul&gt;
  25      {% if user.is_authenticated %}
  26  
          &lt;li&gt;&lt;a href="
        {% url 'account_email' %}
        "&gt;Change E-mail&lt;/a&gt;&lt;/li&gt;
  
  
  27      &lt;li&gt;&lt;a href="{% url 'account_logout' %}"&gt;Sign Out&lt;/a&gt;&lt;/li&gt;
  28      {% else %}
  29      &lt;li&gt;&lt;a href="{% url 'account_login' %}"&gt;Sign In&lt;/a&gt;&lt;/li&gt;
  30      &lt;li&gt;&lt;a href="{% url 'account_signup' %}"&gt;Sign Up&lt;/a&gt;&lt;/li&gt;
  31      {% endif %}
  32        &lt;/ul&gt;
  33      &lt;/div&gt;
  34      {% block content %}
  35      {% endblock %}
  36      {% endblock %}
  </code></pre>
  
  <p>So I think the code I used from the linked github issue is correct for the confirmation email, and this error happens during render of the template after the allauth view confirms the email address. I would expect the URLs in lines 26-30 above to be part of the <code>include('rest_auth.registration.urls')</code> set, since the django-rest-auth registration option uses django-allauth.</p>
  
  <p>I'm not sure what I'd need to do to get this URL working if the allauth view is handling the confirmation correctly. I could be wrong about that guess, though.</p>
  
  <p><strong>EDIT 2</strong>
  I took the advice from a comment below and printed off all the URLs:</p>
  
  <pre><code>&gt;&gt;&gt; show_urls(urls.urlpatterns)
  ^api/
     ^$
     ^\.(?P&lt;format&gt;[a-z0-9]+)/?$
  
     ....autogenerated viewset URLs....
  
   ^api-browse/
     ^login/$
     ^logout/$
   ^rest-auth/
     ^password/reset/$
     ^password/reset/confirm/$
     ^login/$
     ^logout/$
     ^user/$
     ^password/change/$
   ^rest-auth/registration/account-confirm-email/(?P&lt;key&gt;[-:\w]+)/$
   ^rest-auth/registration/
     ^$
     ^verify-email/$
     ^account-confirm-email/(?P&lt;key&gt;\w+)/$
   ^$
  
   ....explicitly added URLs for custom viewset methods...
  
   ^register/$
   ^login/$
   ^logout$
   ^admin/
  
     ....admin URLs....
  </code></pre>
  
  <p>The <code>NoReverseMatch</code> error makes sense now, since the URL patterns on the allauth confirm email view simply aren't present. </p>
  
  <p>I noticed in the linked StackOverflow question that the poster had included the allauth urls as so:</p>
  
  <pre><code>url(r'^accounts/', include('allauth.urls')),
  </code></pre>
  
  <p>When I added this line, it worked!</p>