Why is the django routing system getting longer and longer?

I directly enter the address http://127.0.0.1:8000/boycott/ajaxTot/ can be opened, but the address that jumps through httpResponseRedirect is wrong? I thought I understood the routing system of
django, but this example confused myself why it appeared in the form of 127.0.0.1:8000/a/b/a/b.html. My routing definition is clearly 127.0.0.1:8000/a/b
below is the def ajaxTot (res) in my structure diagram

url.py


app urls.py


indexajaxid
views.py


ajax a/b/a/b url
index.html


ajaxjs




views.py. If I interchange the two positions in the red box, Then the console can normally display the content of my page, rather than the page jump, this question has been perplexed for a long time, please answer, thank you

Mar.20,2021

in the ajaxTot method of

views

return HttpResponseRedirect('boycott/ajaxTot.html')
Change

to

return HttpResponseRedirect('/boycott/ajaxTot.html')

if redirected, the parameter should be the name of the view function. It's not the path of the template page, as I remember. Take a look at it again.

that's what I usually write about redirecting. Take a look. For example, redirect to the login interface after logging out.

@login_required
def log_out(request):
    logout(request)
    return redirect('log_in')
Menu