gpt4 book ai didi

python - Django 的用户身份验证系统的默认 URL 是什么?

转载 作者:太空狗 更新时间:2023-10-29 17:58:19 25 4
gpt4 key购买 nike

Django 的用户身份验证系统 ( http://docs.djangoproject.com/en/dev/topics/auth/ ) 在与用户打交道时非常有帮助。但是,该文档讨论了密码重置表单,并使它看起来像处理用户登录/注销一样处理它。

登录和注销的默认URL是

/accounts/login/&/accounts/logout

是否已经有用于更改密码的默认设置,或者我是否必须构建该功能?

最佳答案

如果你看django.contrib.auth.urls您可以看到定义的默认 View 。这将是 loginlogoutpassword_changepassword_reset

These URLs are normally mapped to /admin/urls.py. This URLs file is provided as a convenience to those who want to deploy these URLs elsewhere. This file is also used to provide a reliable view deployment for test purposes.

所以你可以在你的 urlconf 中连接它们:

url('^accounts/', include('django.contrib.auth.urls')),

因为您可能想要自定义这些 View (不同的表单或模板),所以我认为您无论如何都会重新定义这些 url。但这仍然是一个很好的起点。

关于python - Django 的用户身份验证系统的默认 URL 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4951203/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com