urls.py for my_app:
urlpatterns = [
# 4 inbuilt views for password reset:
# - password_reset sends the mail
# - password_reset_done shows a success message for the above
# - password_reset_confirm checks the link the user clicked and prompts for a new password
# - password_reset_complete shows a success message for the above
url(r'^password-reset/$',
auth_views.password_reset,
{'template_name': 'password_reset/password_reset.html',
'email_template_name': 'password_reset/password_reset_email.html',
'subject_template_name': 'password_reset/password_reset_subject.txt'},
name="password_reset"),
url(r'^password-reset/done/$',
auth_views.password_reset_done,
{'template_name': 'password_reset/password_reset_done.html'},
name="password_reset_done"),
url(r'^password-reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
auth_views.password_reset_confirm,
{'template_name': 'password_reset/password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^password-reset/complete/$',
auth_views.password_reset_complete,
{'template_name': 'password_reset/password_reset_complete.html'},
name="password_reset_complete"),
#url('^password-change/', auth_views.password_change,
# {'post_change_redirect':reverse_lazy('userlogout'), 'template_name':'accountmanagement.html'},
# name="passwordchange"),
]
项目的urls.py:
urlpatterns = [
url(r'^$', LandingPage.as_view(), name="homepage"),
url(r'^my_app/', include('my_app.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
当我访问localhost:8000/my_app/password-reset/
时,我会获得landingpage.html
模板。开发服务器输出肯定会显示一个GET
到/my_app/password-reset/
,并且我已经检查了所有项目的应用程序&#39; urls.py
; password-reset
网址在其他任何地方都不会重复。
我甚至在我的设置文件中注释了该应用程序的TEMPLATES
目录,试图强制TemplateDoesNotExist
,但它什么也没做 - 密码重置视图似乎忽略我在url配置文件中传递的template_name
参数。
我很难过。什么可能导致这个?
答案 0 :(得分:0)
刚才意识到其他人正在开发代码库。 reset_password.html
应该{% extends "landingpage.html" %}
,但是前端工程师重建了landingpage.html而没有{% block content %}
所需的可扩展性,因此它只显示了目标网页模板。