TemplateDoesNotExist??

Three of my pages are dropping the same error for the same cause and I’m getting stressed because I can’t find where this error is, I checked everything and I really need help, here I leave the errors and the files that compose them.

===Fotocopias===

Error

TemplateDoesNotExist at /Fotocopias/VerFotocopias/
Fotocopias/VerFotocopias.html
Request Method:	GET
Request URL:	http://127.0.0.1:8000/Fotocopias/VerFotocopias/
Django Version:	5.0.8
Exception Type:	TemplateDoesNotExist
Exception Value:	
Fotocopias/VerFotocopias.html
Exception Location:	C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader.py, line 19, in get_template
Raised during:	Fotocopias.views.ver_fotocopias
Python Executable:	C:\Users\joegi\AppData\Local\Programs\Python\Python312\python.exe
Python Version:	3.12.5
Python Path:	
['C:\\Users\\joegi\\Documents\\Codigos\\Trimeste2\\Django\\BackEnd\\Sala_Internet',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\DLLs',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\Lib',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']
Server time:	Wed, 25 Sep 2024 10:58:30 +0000
Template-loader postmortem
Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader: C:\Users\joegi\Documents\Codigos\Trimeste2\Django database\FrontEnd\Fotocopias\VerFotocopias.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\admin\templates\Fotocopias\VerFotocopias.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\templates\Fotocopias\VerFotocopias.html (Source does not exist)

Fotocopias.views.py

from django.core import serializers
from django.db.models import ProtectedError
from django.shortcuts import render, redirect, get_object_or_404
from django.http import JsonResponse, HttpResponse
from django.contrib import messages
import json

from .models import Fotocopias
from .forms import FotocopiasForm

def obtener_fotocopias(request):
    data = Fotocopias.objects.all()
    data = serializers.serialize('json', data)
    data = json.loads(data)
    estado = Fotocopias.objects.exists()
    if not estado:
        data = [{"model": "Fotocopias.fotocopias", "pk": "No hay datos", "Estado": estado,
                "fields": {"Tipo_Fotocopia": "No hay datos", "Precio_Unitario": "No hay Datos"}}]
    return JsonResponse({"ListaFotocopias": data})

def ver_fotocopias(request):
    nuevaFotocopia = FotocopiasForm()
    return render(request, 'Fotocopias/VerFotocopias.html', {"FotocopiasForm": nuevaFotocopia})


def agregar_fotocopias(request):
    if request.method == 'POST':
        nuevaFotocopia = FotocopiasForm(request.POST)
        if nuevaFotocopia.is_valid():
            nuevaFotocopia.save()
            messages.success(request, "Fotocopia agregada")
            messages.info(request, "Se ha agregado la fotocopia correctamente")
            messages.add_message(request, messages.SUCCESS, 'success')
            return redirect('VerFotocopias')
        else:
            messages.info(request, "Error agregando fotocopia")
            messages.error(request, "Ha ocurrido un error agregando la fotocopia")
            messages.add_message(request, messages.ERROR, 'error')
    else:
        nuevaFotocopia = FotocopiasForm()
    return render(request, 'Fotocopias/AgregarFotocopias.html', {"FotocopiasForm": nuevaFotocopia})

def editar_fotocopias(request, ID):
    fotocopia = get_object_or_404(Fotocopias, pk=ID)
    if request.method == 'POST':
        fotocopiaForm = FotocopiasForm(request.POST, instance=fotocopia)
        if fotocopiaForm.is_valid():
            fotocopiaForm.save()
            messages.success(request, "Fotocopia editada")
            messages.info(request, "Se ha editado la fotocopia correctamente")
            messages.add_message(request, messages.SUCCESS, 'success')
            return redirect('VerFotocopias')
        else:
            messages.info(request, "Error editando fotocopia")
            messages.error(request, "Ha ocurrido un error editando la fotocopia")
            messages.add_message(request, messages.ERROR, 'error')
    else:
        fotocopiaForm = FotocopiasForm(instance=fotocopia)
    return render(request, 'Fotocopias/EditarFotocopia.html', {"FotocopiasForm": fotocopiaForm})

def eliminar_fotocopias(request, ID):
    try:
        fotocopia = get_object_or_404(Fotocopias, pk=ID)
        fotocopia.delete()
        messages.success(request, "Fotocopia eliminada")
        messages.info(request, "Fotocopia eliminada correctamente")
        messages.add_message(request, messages.SUCCESS, 'success')
    except ProtectedError:
        messages.info(request, "Error eliminando fotocopia")
        messages.error(request, "No se puede eliminar la fotocopia porque está en uso")
        messages.add_message(request, messages.ERROR, 'error')
    except Exception:
        messages.info(request, "Error eliminando fotocopia")
        messages.error(request, "Ha ocurrido un error al eliminar la fotocopia")
        messages.add_message(request, messages.ERROR, 'error')
    return redirect('VerFotocopias')

===Venta Fotocopia===

Error

TemplateDoesNotExist at /VentaFotocopia/VerVentaFotocopia/
VentaFotocopias/VerVentaFotocopias.html
Request Method:	GET
Request URL:	http://127.0.0.1:8000/VentaFotocopia/VerVentaFotocopia/
Django Version:	5.0.8
Exception Type:	TemplateDoesNotExist
Exception Value:	
VentaFotocopias/VerVentaFotocopias.html
Exception Location:	C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader.py, line 19, in get_template
Raised during:	VentaFotocopia.views.ver_venta_fotocopia
Python Executable:	C:\Users\joegi\AppData\Local\Programs\Python\Python312\python.exe
Python Version:	3.12.5
Python Path:	
['C:\\Users\\joegi\\Documents\\Codigos\\Trimeste2\\Django\\BackEnd\\Sala_Internet',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\DLLs',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\Lib',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']
Server time:	Wed, 25 Sep 2024 13:20:51 +0000

VentaFotocopias.views.py

from django.contrib import messages
from django.core import serializers
from django.db.models import ProtectedError
from django.shortcuts import render, redirect, get_object_or_404
from django.http import JsonResponse
import json

from .forms import VentaFotocopiasForm, VentaFotocopiasFormDisabled
from .models import VentaFotocopias



def obtener_venta_fotocopia(request):
    data = VentaFotocopias.objects.all()
    data = serializers.serialize('json', data)
    data = json.loads(data)
    estado = VentaFotocopias.objects.exists()
    if not estado:
        data = [{"model": "VentaFotocopias.venta", "pk": "No hay datos", "fields": {"Codigo_Venta_Fotocopia": "No hay datos",
            "ID_Fotocopia":  "No hay datos",
            "Codigo_Factura": "No hay datos",
            "Cantidad": "No hay datos",
            "Precio_Unitario": "No hay datos"}}]
    return JsonResponse({"ListaVentaFotocopias": data})

def ver_venta_fotocopia(request):
    nuevaVenta = VentaFotocopiasForm()
    return render(request, 'VentaFotocopias/VerVentaFotocopias.html', {"VentaFotocopiasForm": nuevaVenta})

def ver_detalle_venta_fotocopia(request, Codigo):
    factura = get_object_or_404(VentaFotocopias, pk=Codigo)
    ventaForm = VentaFotocopiasFormDisabled(instance=factura)
    return render(request, 'VentaFotocopias/VerDetalleVentaFotocopias.html', {"VentaFotocopiasForm": ventaForm})



def agregar_venta_fotocopia(request):
    if request.method == 'POST':
        nuevaVenta = VentaFotocopiasForm(request.POST)
        if nuevaVenta.is_valid():
            nuevaVenta.save()
            messages.success(request, "Venta agregada")
            messages.info(request, "Se ha agregado la venta correctamente")
            messages.add_message(request, messages.SUCCESS, 'success')
            return redirect('VerVentaFotocopias')
        else:
            messages.success(request, "Error agregando venta")
            messages.info(request, "Ha ocurrido un error agregando la venta")
            messages.add_message(request, messages.ERROR, 'error')
    else:
        nuevaVenta = VentaFotocopiasForm()
    return render(request, 'VentaFotocopias/VerVentaFotocopias.html', {"VentaFotocopiasForm": nuevaVenta})

def editar_venta_fotocopia(request, Codigo):
    venta = get_object_or_404(VentaFotocopias, pk=Codigo)
    if request.method == 'POST':
        ventaForm = VentaFotocopiasForm(request.POST, instance=venta)
        if ventaForm.is_valid():
            ventaForm.save()
            messages.success(request, "Venta editada")
            messages.info(request, "Se ha editado la venta correctamente")
            messages.add_message(request, messages.SUCCESS, 'success')
            return redirect('VerVentaFotocopias')
        else:
            messages.success(request, "Error editando venta")
            messages.info(request, "Ha ocurrido un error editando la venta")
            messages.add_message(request, messages.ERROR, 'error')
    else:
        ventaForm = VentaFotocopiasForm(instance=venta)
    return render(request, 'VentaFotocopias/EditarVentaFotocopias.html', {"VentaFotocopiasForm": ventaForm})

def eliminar_venta_fotocopia(request, Codigo):
    try:
        venta = get_object_or_404(VentaFotocopias, pk=Codigo)
        venta.delete()
        messages.success(request, "Venta eliminada")
        messages.info(request, "Venta eliminada correctamente")
        messages.add_message(request, messages.SUCCESS, 'success')
    except ProtectedError:
        messages.info(request, "Error eliminando Venta")
        messages.error(request, "No se puede eliminar la venta porque está en uso")
        messages.add_message(request, messages.ERROR, 'error')
    except Exception:
        messages.info(request, "Error eliminando venta")
        messages.error(request, "Ha ocurrido un error al eliminar la venta")
        messages.add_message(request, messages.ERROR, 'error')
    return redirect('VerVentaFotocopias')

===Clientes===

Error

TemplateDoesNotExist at /Clientes/VerClientes/
Clientes/VerClientes.html
Request Method:	GET
Request URL:	http://127.0.0.1:8000/Clientes/VerClientes/
Django Version:	5.0.8
Exception Type:	TemplateDoesNotExist
Exception Value:	
Clientes/VerClientes.html
Exception Location:	C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\template\loader.py, line 19, in get_template
Raised during:	Clientes.views.ver_clientes
Python Executable:	C:\Users\joegi\AppData\Local\Programs\Python\Python312\python.exe
Python Version:	3.12.5
Python Path:	
['C:\\Users\\joegi\\Documents\\Codigos\\Trimeste2\\Django\\BackEnd\\Sala_Internet',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\DLLs',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\Lib',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312',
 'C:\\Users\\joegi\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']
Server time:	Wed, 25 Sep 2024 13:24:26 +0000
Template-loader postmortem
Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader: C:\Users\joegi\Documents\Codigos\Trimeste2\Django database\FrontEnd\Clientes\VerClientes.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\admin\templates\Clientes\VerClientes.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\joegi\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\templates\Clientes\VerClientes.html (Source does not exist)

Clientes.views.py

from django.contrib import messages
from django.core import serializers
from django.db.models import ProtectedError
from django.shortcuts import render, redirect, get_object_or_404
from django.http import JsonResponse
import json

from .forms import ClientesForm, ClientesFormDisabled
from .models import Clientes



def obtener_clientes(request):
    data = Clientes.objects.all()
    data = serializers.serialize('json', data)
    data = json.loads(data)
    estado = Clientes.objects.exists()
    if not estado:
        data = [{"model": "Clientes.clientes", "pk": "No hay datos", "fields": {"Documento": "No hay datos",
                                                                            "Nombre": "No hay datos","Apellido": "No hay datos",
                                                                            "Correo": "No hay datos","Telefono": "No hay datos",
                                                                            "Direccion": "No hay datos"}}]
    return JsonResponse({"ListaClientes": data})

def ver_clientes(request):
    nuevaclientes = ClientesForm()
    return render(request, 'Clientes/VerClientes.html', {"ClientesForm": nuevaclientes})

def ver_detalle_clientes(request, Codigo):
    clientes = get_object_or_404(Clientes, pk=Codigo)
    clientesForm = ClientesFormDisabled(instance=clientes)
    return render(request, 'Clientes/VerDetalleClientes.html', {"ClientesForm": clientesForm})



def agregar_clientes(request):
    if request.method == 'POST':
        nuevaClientes = ClientesForm(request.POST)
        if nuevaClientes.is_valid():
            nuevaClientes.save()
            messages.success(request, "clientes agregada")
            messages.info(request, "Se ha agregado la clientes correctamente")
            messages.add_message(request, messages.SUCCESS, 'success')
            return redirect('VerClientes')
        else:
            messages.success(request, "Error agregando clientes")
            messages.info(request, "Ha ocurrido un error agregando la clientes")
            messages.add_message(request, messages.ERROR, 'error')
    else:
        nuevaClientes = ClientesForm()
    return render(request, 'Clientes/VerClientes.html', {"ClientesForm": nuevaClientes})

def editar_clientes(request, Codigo):
    clientes = get_object_or_404(Clientes, pk=Codigo)
    if request.method == 'POST':
        clientesForm = ClientesForm(request.POST, instance=clientes)
        if clientesForm.is_valid():
            clientesForm.save()
            messages.success(request, "clientes editada")
            messages.info(request, "Se ha editado la clientes correctamente")
            messages.add_message(request, messages.SUCCESS, 'success')
            return redirect('VerClientes')
        else:
            messages.success(request, "Error editando clientes")
            messages.info(request, "Ha ocurrido un error editando la clientes")
            messages.add_message(request, messages.ERROR, 'error')
    else:
        clientesForm = ClientesForm(instance=clientes)
    return render(request, 'Clientes/EditarClientes.html', {"ClientesForm": clientesForm})

def eliminar_clientes(request, Codigo):
    try:
        clientes = get_object_or_404(Clientes, pk=Codigo)
        clientes.delete()
        messages.success(request, "clientes eliminada")
        messages.info(request, "clientes eliminada correctamente")
        messages.add_message(request, messages.SUCCESS, 'success')
    except ProtectedError:
        messages.info(request, "Error eliminando clientes")
        messages.error(request, "No se puede eliminar la clientes porque está en uso")
        messages.add_message(request, messages.ERROR, 'error')
    except Exception:
        messages.info(request, "Error eliminando clientes")
        messages.error(request, "Ha ocurrido un error al eliminar la clientes")
        messages.add_message(request, messages.ERROR, 'error')
    return redirect('VerClientes')

We’re going to need a few more details here.

Where are these templates in your directory structure? (Please provide the *full path where those files are located.)

What is the TEMPLATES setting in your settings.py file?

Clientes Template (Clientes.VerClientes.html)

C:\Users\joegi\Documents\Codigos\Trimeste2\Django\FrontEnd\Clientes\VerClientes.html

Fotocopias Template (Fotocopias.VerFotocopias.html)

C:\Users\joegi\Documents\Codigos\Trimeste2\Django\FrontEnd\Fotocopias\VerFotocopias.html

VentaFotocopias Template (VentaFotocopias.VerVentaFotocopias.html)

C:\Users\joegi\Documents\Codigos\Trimeste2\Django\FrontEnd\Clientes\VerClientes.html

settings.TEMPLATES

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['C:\\Users\\joegi\\Documents\\Codigos\\Trimeste2\\Django database\\FrontEnd'], #Modificar
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Having spaces in any directory names is a really bad idea. Also, what you’re showing as the actual directories for your template files doesn’t include a directory named Django database, you’re showing it as Django.