[Python] Not able to fetch data from database GET /favicon.ico HTTP/1.1

Discussão em 'Python' iniciado por Stack, Julho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am building a website for grocery store(Pyshop) and have created ten items using sqlite but I am unable to retrieve the names of the products.

    In the Pyshop >> urls.py file, I have added the address of product path('products/', include('products.urls')),

    In the settings.py file i have also added 'products.apps.ProductsConfig' in installed apps.

    In the project, we have created 2 models -Product and Offer. In Product we are storing name, price, stock and a url for the image. In offer we have code, description, and discount.

    I tried reading about favicon.ico error but I am not able to understand why this error occurs and how to resolve the problem.

    Product>>urls.py is as follows :

    from django.urls import path
    from . import views
    urlpatterns = [
    path('', views.index),
    path('new', views.new)


    Products>>views.py is as follows:

    from django.shortcuts import render
    from .models import Product
    from django.http import HttpResponse

    def index(request):
    products = Product.objects.all()
    return render(request, 'index.html', {'Products': products})

    def new(request):
    return HttpResponse('New Product')


    Products>>templates>>index.html is as follows:

    < h1 > Products < / h1 >

    < ul >
    { % for product in products %}
    < li > {{product.name}}({{product.price}}) < / li >
    { % endfor %}
    < / ul >


    I expect the page in which Products name and price will get printed but nothing is getting printed.

    when I runserver this error is coming on console.

    Watching for file changes with StatReloader
    Performing system checks...

    System check identified no issues (0 silenced).
    November 01, 2019 - 12:57:58
    Django version 2.2.1, using settings 'pyshop.settings'
    Starting development server at http://127.0.0.1:8000/
    Quit the server with CTRL-BREAK.
    [01/Nov/2019 12:58:02] "GET /products/ HTTP/1.1" 200 37
    Not Found: /favicon.ico
    [01/Nov/2019 12:58:02] "GET /favicon.ico HTTP/1.1" 404 2081

    Continue reading...

Compartilhe esta Página