This is my music\urls.py code:-
#/music/
url(r'^/$', views.index, name='index'),#/music/712/
url(r'^(?P<album_id>[0-9]+)/$', views.detail, name='detail'),
And this is my views.py code:-
def index(request):
return HttpResponse("This will be a list of all the albums")def detail(request, album_id):
return HttpResponse("Details for album id: " + str(album_id))
Now why am I getting a Page not found(404) error whenever I try to open this link 127.0.0.1:8000/music/2/ in browser
ERROR MESSAGE:-
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/music/2/ Using the URLconf defined in website.urls, Django tried these URL patterns, in this order: ^admin/ ^music ^/$ [name='index'] ^music ^(?P[0-9]+)/$ [name='detail'] The current URL, music/2/, didn't match any of these.
Error message