我正在尝试使用django的内置网址和视图进行用户身份验证,但已经自定义了html文件,例如login.html注册/ password_reset_form.html
我已经在url.py中导入了网址
from django.contrib.auth import urls
在urlpatterns中
url(r'^account/', include('django.contrib.auth.urls')),
在我的views.py中
from django.contrib.auth.views import *
(没有其他视图函数来处理auth进程)
在我的 registration
文件中有 login.html
password_reset_form.html
password_reset_done.html
...
问题是django视图登录是在注册文件下识别我的login.html,因为它显示我的自定义登录页面,但对于url account/password_reset/
,django password_reset视图函数无法识别我的 password_reset_form.html
,而是使用django password_reset页 .
谁能告诉我问题可能在哪里以及如何解决这个问题?我在这里阅读了django auth代码https://github.com/django/django/tree/master/django/contrib/auth并且真的想使用django内置的url / views来使我的项目成为标准 . 非常感谢你 .
1 回答
filesystem template loader使用settings.TEMPLATE_DIRS来指定查找模板的位置,因此请确保已将包含
registration/
的目录添加到其中(并且您已启用文件系统加载程序) .