Help me pls error POST JSON

I can’t POST JSON in Postman

views.py

from blogsapp.models import Blog
from blogsapp.serializer import BlogSerializer
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status

# Create your views here.
@api_view(['GET','POST'])
def blog_list(request):
    if request.method == 'GET':
        blogs = Blog.objects.all()
        serializer = BlogSerializer(blogs, many = True)
        return Response(serializer.data)
    elif request.method == 'POST':
        serializer = BlogSerializer(data = request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status = status.HTTP_201_CREATED)
        return Response(serializer.errors, status = status.HTTP_400_BAD_REQUEST)

def blog_detail(request, id):
    pass

Postman is showing a RuntimeError on the page. You should get some more detailed output in the logs which will help debug?

If you get an exception, Django will usually give you HTML, as opposed to trying to convert the exception to JSON (because there’s no standard way of doing that).

Welcome @Anuchit !

A couple of side notes here.

When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted. (I’ve taken the liberty of editing your original post for this.)

Also, please avoid posting images of code or other text information here. Copy/paste the text into the body of your post, fenced between lines of ``` as described above.

Finally, when you get an error, it’s always more helpful to post the complete traceback with the error from the server console, not what you see on the client side.