/login/login/signup 处没有反向匹配

问题描述 投票:0回答:1

我正在尝试使用 django 创建一个注册页面 用户按下注册按钮后,我希望页面使用这行代码将他们重定向到另一个页面

return redirect('congrat')
我也已经创建了一个“恭喜”的功能

def congrat(request):
    return render(request,"login/congratulation.html")

url也已在urls.py文件中定义

 path("login/congrat",views.congrat,name = "congrat"),

but for some reason this is the output from the website after the button is clicked

我咨询过chatgpt,它告诉我检查我的urls.py并检查该函数是否已定义(我已经完成了),但我似乎找不到那里的错误。

python django redirect django-views
1个回答
0
投票

这一切都取决于您如何连接网址。我重现了你的问题。请访问 https://github.com/ratidzo/login-redirect 获取解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.