HenryM HenryM - 10 months ago 124
Python Question

NoReverseMatch following v1.9 to v1.10 upgrade

I've just upgraded to django v1.10 and I'm running through tests to check everything works fine but I've getting

Reverse for 'django.contrib.auth.views.login' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
on my login page.

I'm using django-registration and have made a call to get the login page using
<a href="/accounts/login/">Login</a>

I then get the error message against this the html and it is
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
which is throwing up the error.

<div class="container">
<div class="row text-center">
<div class="col-sm-12">
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">{% csrf_token %}
<span style="color:green">{{msg}}</span><br>
<table align="center">{{ form }}</table>
<button type="submit" class="btn btn-primary btn-sm">Login</button>
<a href="/password/recover" class="btn btn-primary btn-sm">Forgotten Password</a>

I've not changed urls.py which looks includes:

url(r'^accounts/', include('registration.backends.hmac.urls')),

I've changed nothing going from 1.9 to 1.10 (and what I changed trying to fix this I've reverted). Any help gratefully received.


From Django 1.10 release notes:

The ability to reverse() URLs using a dotted Python path is removed.

The url template tag uses reverse(). Thus this is not valid anymore:

{% url 'django.contrib.auth.views.login' %}

You must use the route name.

See Django 1.8 release notes for details.