New to python,
Up to this point everything is working in the Web App Vidly.
Looking for YOUR input on correcting this error listed below …
When implementing this section 15-URL Parameters here what was edited, updated or added ,
edited & added to movies/url.py …
urlpatterns = [
path(‘’, views.index, name=‘movies_index’),
path(‘movie_id’, views.detail, name=‘movies_detail’) # works with movies/1 ex.
]
added to movies/views.py …
def detail(request, movie_id):
return HttpResponse(movie_id)
added to vidly/settings.py
import os
from pathlib import Path
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
DIRS': [os.path.join(BASE_DIR,'templates')],
Everything works this far …
then cd … http://127.0.0.1:8000/movies/1 … here is the error
Page not found (404)
Request Method: | GET |
---|---|
Request URL: | http://127.0.0.1:8000/movies/1 |
Using the URLconf defined in vidly.urls
, Django tried these URL patterns, in this order:
- admin/
- movies/ [name=‘movies_index’]
- movies/ movie_id [name=‘movies_detail’]
The current path, movies/1
, didn’t match any of these.
You’re seeing this error because you have DEBUG = True
in your Django settings file. Change that to False
, and Django will display a standard 404 page.