'Django Page Not Found Using SQLite3
Not sure why am I getting this error because I only have 1 item in my ToDoList called "Habibs List" but when I go to http://127.0.0.1:8000/Habibs%20List, it's giving me this error:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/Habibs%20List
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
admin/
<int:id> [name='index']
The current path, Habibs List, didn't match any of these.
This is in my view:
def index(response, name):
ls = ToDoList.objects.get(name=name)
item = ls.item_set.get(id=1)
return HttpResponse("<h1>%s</h1><br></br><p>%s</p>" % (ls.name, str(item.text)))
# def v1(response):
# return HttpResponse("<h1>Game Page</h1>")
# def v2(response):
# return HttpResponse("<h1>Electronic Page</h1>")
My URLconf:
# the path to our different web pages
# like the different views we have in our file
from django.urls import path
from . import views
urlpatterns = [
path("<int:id>", views.index, name="index"),
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
