diff --git a/backend/videoflix/auth/__init__.py b/backend/auth_app/__init__.py similarity index 100% rename from backend/videoflix/auth/__init__.py rename to backend/auth_app/__init__.py diff --git a/backend/videoflix/auth/admin.py b/backend/auth_app/admin.py similarity index 100% rename from backend/videoflix/auth/admin.py rename to backend/auth_app/admin.py diff --git a/backend/videoflix/auth/apps.py b/backend/auth_app/apps.py similarity index 63% rename from backend/videoflix/auth/apps.py rename to backend/auth_app/apps.py index 836fe02..945e148 100644 --- a/backend/videoflix/auth/apps.py +++ b/backend/auth_app/apps.py @@ -1,6 +1,6 @@ from django.apps import AppConfig -class AuthConfig(AppConfig): +class AuthAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'auth' + name = 'auth_app' diff --git a/backend/videoflix/auth/custom_backend.py b/backend/auth_app/custom_backend.py similarity index 100% rename from backend/videoflix/auth/custom_backend.py rename to backend/auth_app/custom_backend.py diff --git a/backend/videoflix/auth/migrations/__init__.py b/backend/auth_app/migrations/__init__.py similarity index 100% rename from backend/videoflix/auth/migrations/__init__.py rename to backend/auth_app/migrations/__init__.py diff --git a/backend/videoflix/auth/models.py b/backend/auth_app/models.py similarity index 100% rename from backend/videoflix/auth/models.py rename to backend/auth_app/models.py diff --git a/backend/videoflix/auth/serializer.py b/backend/auth_app/serializer.py similarity index 100% rename from backend/videoflix/auth/serializer.py rename to backend/auth_app/serializer.py diff --git a/backend/videoflix/auth/tests.py b/backend/auth_app/tests.py similarity index 99% rename from backend/videoflix/auth/tests.py rename to backend/auth_app/tests.py index 32f874e..8180cd9 100644 --- a/backend/videoflix/auth/tests.py +++ b/backend/auth_app/tests.py @@ -2,7 +2,7 @@ from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from rest_framework.authtoken.models import Token -from users.models import CustomUser +from user_app.models import CustomUser class AuthTests(APITestCase): """ diff --git a/backend/videoflix/auth/views.py b/backend/auth_app/views.py similarity index 98% rename from backend/videoflix/auth/views.py rename to backend/auth_app/views.py index e67556e..7c3cb25 100644 --- a/backend/videoflix/auth/views.py +++ b/backend/auth_app/views.py @@ -6,11 +6,11 @@ from rest_framework.authtoken.models import Token from rest_framework.authtoken.views import ObtainAuthToken from django.contrib.auth import authenticate from .serializer import LoginSerializer -from users.serializer import UserSerializer +from user_app.serializer import UserSerializer from django.utils.html import strip_tags from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string -from users.models import CustomUser +from user_app.models import CustomUser from django.db.models import Q class LoginView(APIView): diff --git a/backend/videoflix/templates/forgot_password_mail.html b/backend/templates/forgot_password_mail.html similarity index 100% rename from backend/videoflix/templates/forgot_password_mail.html rename to backend/templates/forgot_password_mail.html diff --git a/backend/videoflix/templates/register_mail.html b/backend/templates/register_mail.html similarity index 100% rename from backend/videoflix/templates/register_mail.html rename to backend/templates/register_mail.html diff --git a/backend/videoflix/content/__init__.py b/backend/user_app/__init__.py similarity index 100% rename from backend/videoflix/content/__init__.py rename to backend/user_app/__init__.py diff --git a/backend/videoflix/users/admin.py b/backend/user_app/admin.py similarity index 100% rename from backend/videoflix/users/admin.py rename to backend/user_app/admin.py diff --git a/backend/videoflix/users/apps.py b/backend/user_app/apps.py similarity index 63% rename from backend/videoflix/users/apps.py rename to backend/user_app/apps.py index 72b1401..f2d1d41 100644 --- a/backend/videoflix/users/apps.py +++ b/backend/user_app/apps.py @@ -1,6 +1,6 @@ from django.apps import AppConfig -class UsersConfig(AppConfig): +class UserAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'users' + name = 'user_app' diff --git a/backend/videoflix/users/forms.py b/backend/user_app/forms.py similarity index 100% rename from backend/videoflix/users/forms.py rename to backend/user_app/forms.py diff --git a/backend/videoflix/content/migrations/__init__.py b/backend/user_app/migrations/__init__.py similarity index 100% rename from backend/videoflix/content/migrations/__init__.py rename to backend/user_app/migrations/__init__.py diff --git a/backend/videoflix/users/models.py b/backend/user_app/models.py similarity index 95% rename from backend/videoflix/users/models.py rename to backend/user_app/models.py index 4375578..06e361e 100644 --- a/backend/videoflix/users/models.py +++ b/backend/user_app/models.py @@ -2,7 +2,7 @@ import string import secrets from django.contrib.auth.models import AbstractUser from django.db import models -from content.models import Video +from video_app.models import Video class CustomUser(AbstractUser): verify_email_token = models.CharField(max_length=20, blank=True, null=True) diff --git a/backend/videoflix/users/serializer.py b/backend/user_app/serializer.py similarity index 100% rename from backend/videoflix/users/serializer.py rename to backend/user_app/serializer.py diff --git a/backend/videoflix/users/tests.py b/backend/user_app/tests.py similarity index 100% rename from backend/videoflix/users/tests.py rename to backend/user_app/tests.py diff --git a/backend/videoflix/users/views.py b/backend/user_app/views.py similarity index 97% rename from backend/videoflix/users/views.py rename to backend/user_app/views.py index f0ff01d..8f0c271 100644 --- a/backend/videoflix/users/views.py +++ b/backend/user_app/views.py @@ -1,5 +1,3 @@ -from django.http import JsonResponse -from django.shortcuts import render from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response diff --git a/backend/videoflix/users/__init__.py b/backend/video_app/__init__.py similarity index 100% rename from backend/videoflix/users/__init__.py rename to backend/video_app/__init__.py diff --git a/backend/videoflix/content/admin.py b/backend/video_app/admin.py similarity index 100% rename from backend/videoflix/content/admin.py rename to backend/video_app/admin.py diff --git a/backend/videoflix/content/apps.py b/backend/video_app/apps.py similarity index 72% rename from backend/videoflix/content/apps.py rename to backend/video_app/apps.py index 36ece36..6e3b337 100644 --- a/backend/videoflix/content/apps.py +++ b/backend/video_app/apps.py @@ -1,9 +1,9 @@ from django.apps import AppConfig -class ContentConfig(AppConfig): +class VideoAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'content' + name = 'video_app' def ready(self): from . import signals diff --git a/backend/videoflix/content/class_assets.py b/backend/video_app/class_assets.py similarity index 100% rename from backend/videoflix/content/class_assets.py rename to backend/video_app/class_assets.py diff --git a/backend/videoflix/users/migrations/__init__.py b/backend/video_app/migrations/__init__.py similarity index 100% rename from backend/videoflix/users/migrations/__init__.py rename to backend/video_app/migrations/__init__.py diff --git a/backend/videoflix/content/models.py b/backend/video_app/models.py similarity index 99% rename from backend/videoflix/content/models.py rename to backend/video_app/models.py index d62599a..51aab66 100644 --- a/backend/videoflix/content/models.py +++ b/backend/video_app/models.py @@ -3,6 +3,7 @@ from django.conf import settings from datetime import date from .class_assets import FILM_GENRES import os + class Video(models.Model): creator = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,default=1) created_at = models.DateField(default=date.today) diff --git a/backend/videoflix/content/serializer.py b/backend/video_app/serializer.py similarity index 100% rename from backend/videoflix/content/serializer.py rename to backend/video_app/serializer.py diff --git a/backend/videoflix/content/signals.py b/backend/video_app/signals.py similarity index 100% rename from backend/videoflix/content/signals.py rename to backend/video_app/signals.py diff --git a/backend/videoflix/content/tasks.py b/backend/video_app/tasks.py similarity index 100% rename from backend/videoflix/content/tasks.py rename to backend/video_app/tasks.py diff --git a/backend/videoflix/content/tests.py b/backend/video_app/tests.py similarity index 94% rename from backend/videoflix/content/tests.py rename to backend/video_app/tests.py index d2887a6..4d18a1e 100644 --- a/backend/videoflix/content/tests.py +++ b/backend/video_app/tests.py @@ -1,8 +1,6 @@ from django.test import TestCase from unittest.mock import patch, MagicMock from .tasks import convert_video_to_hls, delete_original_video -from django.core.files.uploadedfile import SimpleUploadedFile - class VideoTasksTest(TestCase): @patch('subprocess.run') diff --git a/backend/videoflix/content/views.py b/backend/video_app/views.py similarity index 96% rename from backend/videoflix/content/views.py rename to backend/video_app/views.py index 5ecd6fc..88e47ab 100644 --- a/backend/videoflix/content/views.py +++ b/backend/video_app/views.py @@ -1,4 +1,3 @@ -from django.shortcuts import render from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response @@ -7,7 +6,6 @@ from .models import Video from django.core.cache.backends.base import DEFAULT_TIMEOUT from django.views.decorators.cache import cache_page from django.conf import settings -from django.http import FileResponse, Http404 from rest_framework.parsers import MultiPartParser, FormParser from django.http import JsonResponse import os diff --git a/backend/videoflix/videoflix/__init__.py b/backend/videoflix/__init__.py similarity index 100% rename from backend/videoflix/videoflix/__init__.py rename to backend/videoflix/__init__.py diff --git a/backend/videoflix/videoflix/asgi.py b/backend/videoflix/asgi.py similarity index 100% rename from backend/videoflix/videoflix/asgi.py rename to backend/videoflix/asgi.py diff --git a/backend/videoflix/manage.py b/backend/videoflix/manage.py deleted file mode 100755 index 7c4f798..0000000 --- a/backend/videoflix/manage.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -"""Django's command-line utility for administrative tasks.""" -import os -import sys - - -def main(): - """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'videoflix.settings') - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == '__main__': - main() diff --git a/backend/videoflix/videoflix/settings.py b/backend/videoflix/settings.py similarity index 97% rename from backend/videoflix/videoflix/settings.py rename to backend/videoflix/settings.py index 4236996..49b0e82 100644 --- a/backend/videoflix/videoflix/settings.py +++ b/backend/videoflix/settings.py @@ -68,8 +68,8 @@ INSTALLED_APPS = [ 'debug_toolbar', 'django_rq', 'import_export', - 'content.apps.ContentConfig', - 'users', + 'user_app', + 'video_app.apps.VideoAppConfig', ] MIDDLEWARE = [ @@ -203,7 +203,8 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # Auth AUTH_EMAIL_VERIFICATION = True -AUTH_USER_MODEL = 'users.CustomUser' + +AUTH_USER_MODEL = 'user_app.CustomUser' # Rest Framework @@ -214,7 +215,7 @@ REST_FRAMEWORK = { } AUTHENTICATION_BACKENDS = ( - 'auth.custom_backend.EmailBackend', + 'auth_app.custom_backend.EmailBackend', 'django.contrib.auth.backends.ModelBackend', ) diff --git a/backend/videoflix/videoflix/urls.py b/backend/videoflix/urls.py similarity index 85% rename from backend/videoflix/videoflix/urls.py rename to backend/videoflix/urls.py index 0298d5d..a437a64 100644 --- a/backend/videoflix/videoflix/urls.py +++ b/backend/videoflix/urls.py @@ -18,8 +18,8 @@ from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static -from users import views as user_views -from auth.views import ( +from user_app import views as user_views +from auth_app.views import ( LoginView, RegisterView, VerifyEmailView, @@ -27,7 +27,7 @@ from auth.views import ( ForgotPasswordView, ChangePasswordView ) -from content import views as content_views +from video_app import views as video_views from debug_toolbar.toolbar import debug_toolbar_urls from django.contrib.staticfiles.urls import staticfiles_urlpatterns @@ -36,9 +36,9 @@ urlpatterns = [ path('django-rq/', include('django_rq.urls')), # Content URLs - path('content/', content_views.video_list, name='video_list'), - path('content/upload/', content_views.video_upload, name='video_upload'), - path('content/movie//', content_views.check_video_resolutions, name='check_video_resolutions'), + path('video/', video_views.video_list, name='video_list'), + path('video/upload/', video_views.video_upload, name='video_upload'), + path('video/movie//', video_views.check_video_resolutions, name='check_video_resolutions'), # Users URLs path('users/', user_views.user_list, name='user_list'), diff --git a/backend/videoflix/videoflix/wsgi.py b/backend/videoflix/wsgi.py similarity index 100% rename from backend/videoflix/videoflix/wsgi.py rename to backend/videoflix/wsgi.py diff --git a/frontend/src/app/services/movie.service.ts b/frontend/src/app/services/movie.service.ts index 8133eb9..3debafb 100644 --- a/frontend/src/app/services/movie.service.ts +++ b/frontend/src/app/services/movie.service.ts @@ -12,7 +12,7 @@ export class MovieService { constructor(private http: HttpClient) {} getAllMovies(): Promise { - const url = environment.baseUrl + '/content/'; + const url = environment.baseUrl + '/video/'; const headers = this.getAuthHeaders(); return lastValueFrom(this.http.get(url, { headers })); } @@ -24,7 +24,7 @@ export class MovieService { } uploadMovie(formData: FormData) { - const url = environment.baseUrl + '/content/upload/'; + const url = environment.baseUrl + '/video/upload/'; const headers = this.getAuthHeaders(); return lastValueFrom(this.http.post(url, formData, { headers })); } @@ -74,7 +74,7 @@ export class MovieService { private fetchAndCacheResolutions( videoID: number ): Observable<{ [resolution: string]: boolean }> { - const url = `${environment.baseUrl}/content/movie/${videoID}/`; + const url = `${environment.baseUrl}/video/movie/${videoID}/`; const headers = this.getAuthHeaders(); return new Observable<{ [resolution: string]: boolean }>((observer) => {