Home > Net >  Django : Using the register form i gave the url in the lastline for redirecting to the loginpage it
Django : Using the register form i gave the url in the lastline for redirecting to the loginpage it

Time:12-07

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'),

CodePudding user response:

You made a typo <a href="{% url 'login'}" , you are missing a %

Try this way:

<a href="{% url 'login' %}"> 

CodePudding user response:

Kindly close the tag and it will work. <a href="{% url 'login' %}" > <i ></i>Login </a>

CodePudding user response:

Let's try this way:

In your main project urls.py file:

urlpatterns = [
  path('members/',include('members.urls','url'),namepspace='member')#here just add namespace after include and added url after member.urls
]

And in your template:

<a href="{% url 'member:login' %}"> 

Try this way and check if it solves that problem

  • Related