Skip to content Skip to sidebar Skip to footer

NoReverseMatch At /signup/ - Reverse For '' Not Found

The project I am working on is the blogging website and I am stuck at this signup process, I want it to function like after signup, the user lands on the home page, but instead thi

Solution 1:

You specified path("", views.home, name="home") in your urls.py, therefore you can just do:

return redirect("/")

You shouldn't be passing request as a first argument to redirect(), you only need to provide a URL (relative or absolute) most of the time.

Actually, as a best practice, that URL should be provided using reverse, e.g.:

from django.urls import reverse
...
return redirect(reverse('home'))

See the doc for redirect().


Post a Comment for "NoReverseMatch At /signup/ - Reverse For '' Not Found"