I keep getting this error for the django login system. Here is part of my urls.py:
(r'^contractManagement/login', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
The exact error I am getting:
Exception Type: NoReverseMatch Exception Value: Reverse for ''django.contrib.auth.views.login'' with arguments '()' and keyword arguments '{}' not found.
I can't understand why i am getting this error. If you need anything else let me know.
NoReverseMatch (source code) is a Django exception that is raised when a URL cannot be matched against any string or regular express in your URL configuration. A URL matching problem is often caused by missing arguments or supplying too many arguments.
Use handy request. build_absolute_uri() method on request, pass it the relative url and it'll give you full one. By default, the absolute URL for request. get_full_path() is returned, but you can pass it a relative URL as the first argument to convert it to an absolute URL.
the reverse function allows to retrieve url details from url's.py file through the name value provided there. This is the major use of reverse function in Django. Syntax: Web development, programming languages, Software testing & others. from django.urls import reverse.
You don't show where you are trying to reverse this URL, but it looks like you have double-quoted it. If you're using the url
tag, note that you don't need quotes around the url name:
{% url django.contrib.auth.views.login %}
not
{% url 'django.contrib.auth.views.login' %}
You see that ''the.unknown.view''
is reported including too many qoutes.
It is because the quoted syntax will be valid in Django 1.5 and higher. For Django 1.3 or 1.4, you should activate the future behavior by this line in the template:
{% load url from future %}
which is valid also for Django 1.5.
Example for Django 1.5+
{% url "path.to.some.view" %}
Classic syntax for Django <= 1.4.x (without "future" command) is:
{% url path.to.some.view %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With