The complete error message I'm getting is:
Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
I'm trying to use the standard DJANGO auth libraries to implement signin, logoff, password reset and sign up functionality/views to my site.
I'm using the Anaconda 4.6 package and I'm importing the DJANGO libraries as below
from django.contrib.auth import views as auth_views
The (relevant) urlpatterns I have are:
url(r'^password_reset/$', auth_views.password_reset, name='password_reset'),
url(r'^password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'),
If I go to the URL
/password_reset/done/
I reach the page.
If I go to the URL
/password_reset/
I get the failed reverse error.
I've been reading the documentation for 2 days but I don't seem to be able to find out why
url(r'^password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'),
is blocking the django reverse function. Does anyone have any ideas?
Thanks a lot!
Traceback here too for more details:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/password_reset/
Django Version: 1.10.5
Python Version: 3.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'bootstrap3',
'app1']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\core\handlers\exception.py" in inner
39. response = get_response(request)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\core\handlers\base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\core\handlers\base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\contrib\auth\views.py" in inner
47. return func(*args, **kwargs)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\utils\decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\contrib\auth\views.py" in password_reset
189. post_reset_redirect = reverse('password_reset_done')
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\urls\base.py" in reverse
91. return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\django\urls\resolvers.py" in _reverse_with_prefix
392. (lookup_view_s, args, kwargs, len(patterns), patterns)
Exception Type: NoReverseMatch at /password_reset/
Exception Value: Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Adding some additional info:
projects urls:
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^app1/',include('app1.urls')),
url(r'^',include('app1.urls')),
]
Template code for 'app1\registration\login.html' which renders correctly:
{% block title %}Login{% endblock %}
{% block content %}
<h2>Login</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Login</button>
</form>
{% endblock %}
Template code for 'app1\registration\password_reset_done.html' which throws the error:
{% block content %}
<p>
We've emailed you instructions for setting your password, if an account exists with the email you entered.
You should receive them shortly.
</p>
<p>
If you don't receive an email, please make sure you've entered the address you registered with,
and check your spam folder.
</p>
{% endblock %}