I have created an post api which will upload images and videos for blogs. I can handle multiple images, not a problem there. But I have to send a video as well from the frontend. I have used Filefield for video. I am no expert in apis but what I think is, since the code I have written is synchronous, everything that I have written will be be done at the same time. Now the issue is, if a user wants to upload a very large video for eg 200-500 mb then, the post api call response will be very long. Is there a way I can save the blog post first, return the response and then start uploading the video in the database of live server.
My models:
class Blogposts(models.Model):
blog_title = models.CharField(max_length=100blank=True)
video = models.FileField(upload_to="media",
null= True)
I tried to use django signals, but then again django signals are also synchronous.Everything I stated above might be wrong as well, I am not sure. But how to approach this?? Or should I use django celery??