You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
from django . urls import path
from django . urls import re_path
from . import views
from . forms import LoginForm
# 指定命名空间,方便在模板或其他地方反向解析 URL
app_name = " accounts "
# URL 配置列表
urlpatterns = [
# 登录页面
re_path (
r ' ^login/$ ' , # 匹配 URL /login/
views . LoginView . as_view ( success_url = ' / ' ) , # 使用自定义 LoginView, 登录成功后跳转到主页 '/'
name = ' login ' , # URL 名称,反向解析使用
kwargs = { ' authentication_form ' : LoginForm } # 使用自定义登录表单 LoginForm
) ,
# 注册页面
re_path (
r ' ^register/$ ' , # 匹配 URL /register/
views . RegisterView . as_view ( success_url = " / " ) , # 注册成功后跳转到主页 '/'
name = ' register '
) ,
# 登出页面
re_path (
r ' ^logout/$ ' , # 匹配 URL /logout/
views . LogoutView . as_view ( ) , # 使用 Django 内置 LogoutView
name = ' logout '
) ,
# 账户操作结果页面(如修改信息后的结果展示)
path (
r ' account/result.html ' , # 匹配 URL /account/result.html
views . account_result , # 调用 account_result 函数视图
name = ' result '
) ,
# 忘记密码页面
re_path (
r ' ^forget_password/$ ' , # 匹配 URL /forget_password/
views . ForgetPasswordView . as_view ( ) , # 使用 ForgetPasswordView 类视图
name = ' forget_password '
) ,
# 发送忘记密码验证码
re_path (
r ' ^forget_password_code/$ ' , # 匹配 URL /forget_password_code/
views . ForgetPasswordEmailCode . as_view ( ) , # 使用 ForgetPasswordEmailCode 类视图处理发送验证码
name = ' forget_password_code '
) ,
]