I am stuck with lesson # 16 : Getting a single object - in the Mosh python tutorial. I had been following the tutorials along , practicing in my PC successfully till now. At this point , I can’t get the kind of result Mosh is getting on refreshing the browser after the changes in “movies/views.py” and
“movies/templates/movies/detail.html”. I have been struggling to find the problem for 3 days now without success. Please can I get any help?.
views.py:
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from .models import Movie
Create your views here.
def index(request):
movies = Movie.objects.all()
return render(request, ‘movies/index.html’, {‘movies’: movies})
def detail(request, movie_id):
movie = get_object_or_404(Movie, id=movie_id)
return render(request, ‘movies/detail.html’, {‘movie’: movie})
detail.html:
% extends ‘base.html’ %}
{% block content %}
- Title
- {{movie.title}}
- Genre
- {{movie.genre}}
- Stock
- {{movie.number_in_stock}}
The error I get at the terminal is :
[22/Jun/2023 18:45:19] “GET /movies/ HTTP/1.1” 200 1228
Not Found: /favicon.ico.
Thanks in advance.