skip to Main Content

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


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

    Try this way:

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

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search