Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in aluraescola.urls, Django tried these URL patterns, in this order:
admin/
alunos/
The empty path 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.
Pq está dando esse erro?
from django.http import JsonResponse
def alunos (request):
if request.method == 'GET':
aluno = {'id' :1, 'nome':'Jonathan'}
return JsonResponse(aluno)
from django.contrib import admin
from django.urls import path
from escola.views import alunos
urlpatterns = [
path('admin/', admin.site.urls),
path('alunos/', alunos),
]