February 2019
Intermediate to advanced
450 pages
9h 59m
English
The urls file is a routing mechanism in Django. Open decentralized_videos/videos/urls.py, delete the content, and replace it with the following script:
from django.urls import pathfrom . import viewsurlpatterns = [ path('', views.index, name='index'), path('channel/<str:video_user>', views.channel, name='channel'), path('video/<str:video_user>/<int:index>', views.video, name='video'), path('upload-video', views.upload, name='upload'), path('like-video', views.like, name='like'),]
Remember the views file we created previously? Here, we map the views into routing. We access the video-playing page by using http://localhost:8000/video/0x0000000000000000000000000000000000000000/1. The parameters will be mapped into the video_user variable ...
Read now
Unlock full access