when i click the login button here im getting page not found..
This is my template file i gave like this
im getting like this error plz any one can solve this im new Django framework
Im trying to click the login button but it not redirecting to the login page it getting like the page is not found i gave the correct url
<a href="{% url 'login' %}"
but im not getting plz any solve this issue
urls.py
from django.urls import path
from .views import crud
from .views import auth
app_name = ‘members’
urlpatterns = [
path(‘hello/’, crud.index, name=’index’),#views filename and index is the function name
path(‘add/’, crud.add, name=’add’),
#ADDING THE NEW USER
path(‘add/addrecord/’, crud.addrecord, name=’addrecord’),
#DELETE ROUTE
path(‘delete/int:id’, crud.delete, name=’delete’),
#UPDATE ROUTES
path(‘update/int:id’, crud.update, name=’update’),
path(‘update/updaterecord/int:id’, crud.updaterecord, name=’updaterecord’),
#LOGIN $ REGISTER ROUTES..
path("register/", auth.register, name="register"),
path("login/", auth.login_user, name="login"),
path('', auth.home, name='home'),
3
Answers
You made a typo
<a href="{% url 'login'}"
, you are missing a%
Try this way:
Kindly close the tag and it will work.
<a class="" href="{% url 'login' %}" > <i class=""></i>Login </a>
Let’s try this way:
In your main project urls.py file:
And in your template:
Try this way and check if it solves that problem