From 9465ba7f18d180cd93c7b24aae3ad7bab308a9e6 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Sun, 18 Aug 2024 10:03:28 +0200 Subject: [PATCH] clean code --- backend/requirements.txt | 4 ++-- backend/videoflix/auth/views.py | 9 +++++---- backend/videoflix/content/tasks.py | 5 ++--- backend/videoflix/videoflix/settings.py | 1 + frontend/src/app/environments/environment.ts | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/backend/requirements.txt b/backend/requirements.txt index 91d6313..b3cd4e6 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -20,7 +20,6 @@ imageio-ffmpeg==0.5.1 MarkupSafe==2.1.5 numpy==2.0.1 packaging==24.1 -pillow==10.4.0 psutil==6.0.0 psycopg2-binary==2.9.9 pubcontrol==3.5.0 @@ -32,4 +31,5 @@ setuptools==72.1.0 six==1.16.0 sqlparse==0.5.1 tablib==3.5.0 -urllib3==2.2.2 \ No newline at end of file +urllib3==2.2.2 +Werkzeug==3.0.3 \ No newline at end of file diff --git a/backend/videoflix/auth/views.py b/backend/videoflix/auth/views.py index a6d1bc9..5f05d72 100644 --- a/backend/videoflix/auth/views.py +++ b/backend/videoflix/auth/views.py @@ -1,3 +1,4 @@ +from django.conf import settings from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status, authentication @@ -64,8 +65,8 @@ class RegisterView(APIView): message = EmailMultiAlternatives( subject='Confirm your email', body=strip_tags(html_body), # Plain text fallback - from_email='noreply@videoflix.com', - to=user.email + from_email=settings.DEFAULT_FROM_EMAIL, + to=[user.email] ) message.attach_alternative(html_body, "text/html") message.send(fail_silently=False) @@ -115,8 +116,8 @@ class ForgotPasswordView(APIView): message = EmailMultiAlternatives( subject='Reset your Password', body=strip_tags(html_body), # Plain text fallback - from_email='noreply@videoflix.com', - to=user.email + from_email=settings.DEFAULT_FROM_EMAIL, + to=[user.email] ) message.attach_alternative(html_body, "text/html") message.send(fail_silently=False) diff --git a/backend/videoflix/content/tasks.py b/backend/videoflix/content/tasks.py index c1909f4..6231f50 100644 --- a/backend/videoflix/content/tasks.py +++ b/backend/videoflix/content/tasks.py @@ -1,4 +1,4 @@ -import re +import shutil import subprocess import ffmpeg import os @@ -13,8 +13,7 @@ def convert_video_to_hls(source, resolution, model_id): base_filename = os.path.basename(source).split(".")[0] target = os.path.join(target_dir, f'{base_filename}_{resolution}p') - #ffmpeg_path = '/opt/homebrew/bin/ffmpeg' - ffmpeg_path = '/usr/bin/ffmpeg' + ffmpeg_path = shutil.which("ffmpeg") cmd = [ ffmpeg_path, '-i', source, diff --git a/backend/videoflix/videoflix/settings.py b/backend/videoflix/videoflix/settings.py index 56a4e9a..0db2b7f 100644 --- a/backend/videoflix/videoflix/settings.py +++ b/backend/videoflix/videoflix/settings.py @@ -33,6 +33,7 @@ EMAIL_PORT = 587 EMAIL_HOST_USER = 'andre.kempf.dev@gmail.com' EMAIL_HOST_PASSWORD = 'oyxwawshudwytgud' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +DEFAULT_FROM_EMAIL = 'noreply@videoflix.com' ALLOWED_HOSTS = [ 'videoflix-django.andre-kempf.com', diff --git a/frontend/src/app/environments/environment.ts b/frontend/src/app/environments/environment.ts index 677b433..eb946eb 100644 --- a/frontend/src/app/environments/environment.ts +++ b/frontend/src/app/environments/environment.ts @@ -1,6 +1,6 @@ export const environment = { // Development - //baseUrl: 'http://127.0.0.1:8000', + // baseUrl: 'http://127.0.0.1:8000', // Live baseUrl: 'https://videoflix-django.andre-kempf.com',