[Python] Handle POST Request in DJANGO

Discussão em 'Python' iniciado por Stack, Junho 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am new to DJANGO, and I am currently working on a project where I upload a file through a react page to a back-end handled by the DJANGO REST framework, after receiving the file I have to do some data processing.

    After some research I found that this logic is supposed to be in the views.py. So how do I create function which does this processing and how do I get it called whenever the server receives a new file or a POST request has been made.

    views.py

    from .models import FileStorage
    from rest_framework import viewsets
    from .serializers import FilesSerializer

    class FileViewSet(viewsets.ModelViewSet):
    queryset = FileStorage.objects.all()
    serializer_class = FilesSerializer

    Continue reading...

Compartilhe esta Página