I am just trying out django and following the documentation for authentication.
Basically I want to take a look at the user login form page, but I am getting:
Caught NoReverseMatch while rendering: Reverse for ''django.contrib.auth.views.login'' with arguments '()' and keyword arguments '{}' not found.
My urls.py file:
from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('',
url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
)
My settings.py (INSTALLED_APPS)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
)
EDIT: I realized I was looking at the wrong thing. The error occurs in the template file:
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
<table>
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
Specifically for the line:
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
Try this:
And after your edit:
EDIT
in
settings.pyfile of django, this line:APPEND_SLASH = Falsetells whether your reverse url finish with slash or not. Then
should work as well.