Now let's create the view file of the videos application. A view is a controller that is like an API endpoint. The file is located in decentralized_videos/videos/ Refer to the code file at the following GitLab link for the full code:

from django.shortcuts import render, redirectfrom videos.models import videos_sharingdef index(request):    videos = videos_sharing.recent_videos()    context = {'videos': videos}    return render(request, 'videos/index.html', context)......def like(request):    video_user = request.POST['video_user']    index = int(request.POST['index'])    password = request.POST['password'] video_liker ...

Get Hands-On Blockchain for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.