Fix Celery startup and ImageService temp handling

This commit is contained in:
2025-12-12 20:23:00 +03:00
parent f320eafc55
commit 6023496a7d
3 changed files with 9 additions and 6 deletions

View File

@@ -167,7 +167,7 @@ case "$1" in
wait_for_postgres wait_for_postgres
wait_for_redis wait_for_redis
echo "Starting Celery Worker..." echo "Starting Celery Worker..."
exec celery -A myproject worker \ exec celery -A myproject.celery:app worker \
-l info \ -l info \
-Q celery,photo_processing \ -Q celery,photo_processing \
--concurrency=2 --concurrency=2

View File

@@ -1,8 +1,6 @@
""" """
=8F80;870F8O Celery 4;O 02B><0B8G5A:>9 703@C7:8 ?@8 AB0@B5 Django. Celery configuration.
This ensures the Celery app is loaded when Django starts.
-B> 30@0=B8@C5B GB> Celery app 1C45B 8=8F80;878@>20= 2 <><5=B 70?CA:0 Django,
GB> ?>72>;O5B @shared_task 45:>@0B>@C @01>B0BL ?@028;L=>.
""" """
from .celery import app as celery_app from .celery import app as celery_app

View File

@@ -73,7 +73,12 @@ class ImageService:
parts = path_str.split('/') parts = path_str.split('/')
if len(parts) < 3: if len(parts) < 3:
return '' return default_storage.url(path_str)
# Если изображение во временной папке (еще не обработано)
# Возвращаем оригинал, так как других размеров еще нет
if 'temp' in parts:
return default_storage.url(path_str)
# Извлекаем base_path, entity_id, photo_id из пути # Извлекаем base_path, entity_id, photo_id из пути
base_path = parts[0] # products, kits, categories base_path = parts[0] # products, kits, categories