Я не могу увидеть свою ошибку. Почему я получаю эту ошибку? raise RequestsJSONDecodeError
......................... ....................... ...................... Когда я выполняю python py_client/details.py, я получаю:
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char
0)
Что здесь происходит?
detail.py
import requests
endpoint = "http://localhost:8000/api/products/1"
get_response = requests.get(endpoint)
print(get_response.text)
это urls.product
from django.urls import path
from . import views
urlpatterns = [
path('<int:pk>/', views.ProductDetailAPIview.as_view()),
path('', views.ProductCreateAPIview.as_view()),
]
I am getting error Expecting value: line 1 column 1 (char 0)
It doesn´t work in the browser either. It says: Page not found (404)
это urls.cfehome
from django.contrib import admin
from django.urls import path
from django.urls import include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include("new_api.urls")),
path('/api/products/', include("products.urls"))
]
это мой вид в приложении продукты
from rest_framework import generics
from .models import Product
from .serializers import Productserializers
class ProductDetailAPIview(generics.RetrieveAPIView):
queryset = Product.objects.all()
serializer_class = Productserializers
class ProductCreateAPIview(generics.CreateAPIView):
queryset = Product.objects.all()
serializer_class = Productserializers