Environment: win10, Python3.7, Django2.2.15
Can't find the routing address
. Check the big brother's code Django2_dailyfresh , and found that I wrote an extra reverse analysis (reverse)
# 获取登录后要跳转到的地址,默认跳转到首页
next_url = request.GET.get('next',reverse('goods:index')) # 获取不到next,默认返回商品首页
# 跳转到next_url
response = redirect(reverse(next_url)) # HttpResponseRedirect
The correct writing is as follows
# 获取登录后要跳转到的地址,默认跳转到首页
next_url = request.GET.get('next',reverse('goods:index')) # 获取不到next,默认返回商品首页
# 跳转到next_url
response = redirect(next_url) # HttpResponseRedirect