Python function w/ same method as index doesn't work, prints only under index. What to do? [closed]

views.py

def index(request):
    print("passed through index method")
    return render(request, "title/index.html", {})
   
def q(request):
    print("passed through q method")
    return render(request, "title/index.html", {})

def testss(request):
    print("passed through testss method")
    return render(request, "title/index.html", {})

urls.py

urlpatterns = [
    path("", views.index, name="index"),
    path("test", views.q, name="q"),
    path("testss", views.testss, name="testss"),
]

I am a beginner in python and I was coding different functions. But for some reason methods that aren't named after "index" returns "NONE".

What I've done is to replace the methods with the same method as the original index function. I did this to check if maybe it was solely a method problem.

Only prints under "index" function work. So if I interchange "q" and "index", it will only print "passed through q method". I'm using a local server.

I've been on this for a while and I can't seem to figure out what's wrong with this yet. Your insight would immensely help!

Вернуться на верх