Click here to Skip to main content
15,672,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
urls.py:
    ```
    from django.urls import path
    from .views import user,login,bill,index,add_items,admin,pay
    urlpatterns=[
    path('',index,name="index"),
    path('user/', user, name='user'),
    path('login/',login,name="login"),
    path('add_items/',add_items,name="add_items"),
    path('admin/',admin,name="admin"),
    path('bill/',bill,name="bill"),   
    path('pay/',pay,name="pay"),
    ]
    ```
views.py:
    ```
    from django.shortcuts import render

    def index(request):
         return render(request,"index.html")
    def add_items(request):
         return render(request,"add_items.html")
    def admin(request):
         return render(request,"admin.html")
    def user(request):
         return render(request,"user.html")
    def login(request):
         return render(request,"login.html")
    def pay(request):
         return render(request,"pay.html")

    def bill(request):
         return render(request,"bill.html")
    ```
user.html:

    <button class="b1" type="button" onclick="window.location.href='login/'">
hese.


What I have tried:

Error:
[OPEN THE IMAGE](https://i.stack.imgur.com/g5BSf.png)
Page Not Found

Using the URLconf defined in restaurantpro.urls, Django tried these URL patterns, in this order:

admin/
[name='index']
user/ [name='user']
login/ [name='login']
add_items/ [name='add_items']
admin/ [name='admin']
bill/ [name='bill']
pay/ [name='pay']
The current path, user/login/, didn’t match any of t
Posted
Updated 25-Feb-23 21:28pm

1 solution

You are trying to access a URL that ends in /user/login, which does not exist. You have only defined /login.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900