upload videos in the backend
This commit is contained in:
parent
4fe20b908e
commit
bf0785bc78
9 changed files with 35 additions and 3 deletions
0
backend/videoflix/content/__init__.py
Normal file
0
backend/videoflix/content/__init__.py
Normal file
4
backend/videoflix/content/admin.py
Normal file
4
backend/videoflix/content/admin.py
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import Video
|
||||||
|
|
||||||
|
admin.site.register(Video)
|
||||||
6
backend/videoflix/content/apps.py
Normal file
6
backend/videoflix/content/apps.py
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ContentConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'content'
|
||||||
0
backend/videoflix/content/migrations/__init__.py
Normal file
0
backend/videoflix/content/migrations/__init__.py
Normal file
11
backend/videoflix/content/models.py
Normal file
11
backend/videoflix/content/models.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
from django.db import models
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
|
class Video(models.Model):
|
||||||
|
created_at = models.DateField(default=date.today)
|
||||||
|
title = models.CharField(max_length=80)
|
||||||
|
description = models.CharField(max_length=500)
|
||||||
|
video_file = models.FileField(upload_to='videos', blank=True, null=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
3
backend/videoflix/content/tests.py
Normal file
3
backend/videoflix/content/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
3
backend/videoflix/content/views.py
Normal file
3
backend/videoflix/content/views.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
|
@ -51,6 +51,7 @@ INSTALLED_APPS = [
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'corsheaders',
|
'corsheaders',
|
||||||
|
'content',
|
||||||
'users',
|
'users',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -83,6 +84,9 @@ TEMPLATES = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
WSGI_APPLICATION = 'videoflix.wsgi.application'
|
WSGI_APPLICATION = 'videoflix.wsgi.application'
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ Including another URLconf
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
|
from django.conf import settings
|
||||||
|
from django.conf.urls.static import static
|
||||||
from users import views
|
from users import views
|
||||||
from auth.views import LoginView, RegisterView, VerifyEmailView, AuthView, ForgotPasswordView,ChangePasswordView
|
from auth.views import LoginView, RegisterView, VerifyEmailView, AuthView, ForgotPasswordView,ChangePasswordView
|
||||||
|
|
||||||
|
|
@ -28,6 +30,5 @@ urlpatterns = [
|
||||||
path('auth/register/', RegisterView.as_view()),
|
path('auth/register/', RegisterView.as_view()),
|
||||||
path('auth/verify-email/', VerifyEmailView.as_view()),
|
path('auth/verify-email/', VerifyEmailView.as_view()),
|
||||||
path('auth/forgot-password/', ForgotPasswordView.as_view()),
|
path('auth/forgot-password/', ForgotPasswordView.as_view()),
|
||||||
path('auth/change-password/', ChangePasswordView.as_view()),
|
path('auth/change-password/', ChangePasswordView.as_view()),
|
||||||
|
] + static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
|
||||||
]
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue