The main problem is that the urlpatterns in views.py are not being used. This can be caused by a number of reasons, but the most common is that the view is not being used as part of a larger application.
from django.urls import path from .views import APIView urlpatterns = [ path('', APIView.as_view()), ]
This code is importing the path and APIView modules from Django, and then creating a URL pattern that maps to the APIView.
Make an api rest with django
In this tutorial, we will show you how to create a RESTful API with Django. We will use the django-rest-framework library to make our lives easier.
Django REST framework
Django REST framework is a powerful tool for building web APIs. It makes it easy to create robust, well-tested APIs that can be consumed by your applications.
Django REST framework provides a number of features that make it easy to build and maintain your API. First, it includes a well-defined interface for creating resources and managing their relationships. Second, it provides support for authentication and authorization mechanisms, making it easy to control who can access your API and how they are authenticated. Finally, Django REST framework includes built-in support for handling responses payloads and errors. This means that you can easily generate responses that represent the data returned by your API in a format that your applications can use.