I’m working on setting up password resets for users who have forgotten their passwords. I’m running into an issue where I have a namespace for my URL page. If I keep the namespace as it is then I get the error below.
Error during template rendering
In template
\venv\lib\site-packages\django\contrib\admin\templates\registration\password_reset_email.html
, error at line 6
1 {% load i18n %}{% autoescape off %}
2 {% blocktranslate %}You’re receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktranslate %}
3
4 {% translate “Please go to the following page and choose a new password:” %}
5 {% block reset_link %}
6 {{ protocol }}://{{ domain }}{% url ‘password_reset_confirm’ uidb64=uid token=token %}
7 {% endblock %}
8 {% translate ‘Your username, in case you’ve forgotten:’ %} {{ user.get_username }}
9
10 {% translate “Thanks for using our site!” %}
11
12 {% blocktranslate %}The {{ site_name }} team{% endblocktranslate %}
13
14 {% endautoescape %}
15
If I remove the namespace I am getting the email to reset the password, however, the link is going to a default Django page.
You're receiving this email because you requested a password reset for your user account at 127.0.0.1:8000.
Please go to the following page and choose a new password:
http://127.0.0.1:8000/account/reset/Nw/b1cmia-33257461b0ab466b1eaef3fb0aca2f25/
Thanks for using our site!
The 127.0.0.1:8000 team
account/urls.py
app_name = "account"
urlpatterns = [
path('', views.AccountHomeView.as_view(), name='account_home'),
path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout', kwargs={'next_page': '/'}),
path('register/', views.registerPage, name='register'),
path('password_reset/',
auth_views.PasswordResetView.as_view(template_name="registration/password_reset.html")
name="reset_password"),
path('password_reset_sent/',
auth_views.PasswordResetDoneView.as_view(template_name="registration/password_reset_sent.html"),
name="password_reset_done"),
path('reset/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(template_name="registration/password_reset_form.html"),
name="password_reset_confirm"),
path('password_reset_complete/',
auth_views.PasswordResetCompleteView.as_view(template_name="registration/password_reset_done.html"),
name="password_reset_complete"),