From d6cd156b294e9757c8c75e1b619412fc713cb59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=BChler=20Ma=C3=ABlys?= Date: Sat, 16 Mar 2024 16:32:57 +0100 Subject: [PATCH 1/2] Revert "add folder to .env" This reverts commit a5a25ff1a500b961b5d90bd413fb29e9c8bbd9e4. --- api/masteriq/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/masteriq/settings.py b/api/masteriq/settings.py index 8a16ecf..f75db77 100644 --- a/api/masteriq/settings.py +++ b/api/masteriq/settings.py @@ -135,8 +135,8 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' -INIT_DATA_FOLDER = os.getenv("INIT_DATA_FOLDER") #os.path.join('data', 'csv') -IMAGES_FOLDER = os.getenv("IMAGES_FOLDER") #os.path.join('data', 'images') +INIT_DATA_FOLDER = os.path.join('data', 'csv') +IMAGES_FOLDER = os.path.join('data', 'images') DEFAULT_IMAGE = "default.jpeg" From ec056d3771d38b6039a63958b712e6d12a64061b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=BChler=20Ma=C3=ABlys?= Date: Sat, 16 Mar 2024 16:34:48 +0100 Subject: [PATCH 2/2] remove useles print --- api/.env.cicd | 4 +--- api/masteriqapp/migrations/0002_auto_20240303_1147.py | 1 - api/masteriqapp/migrations/0004_auto_20240308_0923.py | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/api/.env.cicd b/api/.env.cicd index 84a7671..c275d85 100644 --- a/api/.env.cicd +++ b/api/.env.cicd @@ -1,6 +1,4 @@ FRONTEND_URL=http://localhost:5173 BACKEND_URL=http://127.0.0.1:5173 DEBUG=True -SECRET_KEY=django-insecure-^=xy+akjdagtjisch+_5fku9!1aw)hhf_&feny8r3@6ds%rds -INIT_DATA_FOLDER=./data/csv/ -IMAGES_FOLDER=./data/images/ \ No newline at end of file +SECRET_KEY=django-insecure-^=xy+akjdagtjisch+_5fku9!1aw)hhf_&feny8r3@6ds%rds \ No newline at end of file diff --git a/api/masteriqapp/migrations/0002_auto_20240303_1147.py b/api/masteriqapp/migrations/0002_auto_20240303_1147.py index 037aa43..626789f 100644 --- a/api/masteriqapp/migrations/0002_auto_20240303_1147.py +++ b/api/masteriqapp/migrations/0002_auto_20240303_1147.py @@ -14,7 +14,6 @@ def load_initial_data(apps, schema_editor): category_model = apps.get_model('masteriqapp', 'Category') directory = settings.INIT_DATA_FOLDER - print(directory) for filename in os.listdir(directory): f = os.path.join(directory, filename) if os.path.isfile(f) and filename.endswith(".csv"): diff --git a/api/masteriqapp/migrations/0004_auto_20240308_0923.py b/api/masteriqapp/migrations/0004_auto_20240308_0923.py index 0a90f7a..801f42d 100644 --- a/api/masteriqapp/migrations/0004_auto_20240308_0923.py +++ b/api/masteriqapp/migrations/0004_auto_20240308_0923.py @@ -12,12 +12,9 @@ def add_category_images(apps, schema_editor): for category in category_model.objects.all(): directory = settings.IMAGES_FOLDER img_name = category.name.lower().replace(' ', '_') + ".*" - print(img_name) f = os.path.join(directory, img_name) files = glob.glob(f) - print("found: " + str(len(files))) if len(files) > 0: - print(files[0]) category.image_path = os.path.join(files[0]) category.save()