From 347354717135b6b9b2726bf1d7c98eec65f609f8 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Thu, 8 Aug 2024 17:13:57 +0300 Subject: [PATCH] aws cloud add --- back/tgbot/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/tgbot/tasks.py b/back/tgbot/tasks.py index 389e940..2d3d116 100644 --- a/back/tgbot/tasks.py +++ b/back/tgbot/tasks.py @@ -16,10 +16,10 @@ aws_secret_access_key = os.environ.get("AWS_SECRET") @celery_app.task def upload_file(file_id): - obj = TmcField.objects.filter(file_id=file_id) - if not obj: + if not TmcField.objects.filter(file_id=file_id).exists(): return + obj = TmcField.objects.get(file_id=file_id) logger.info(f"start upload file {file_id}") file_url = requests.get(f"https://api.telegram.org/bot{settings.TGBOT['TOKEN']}/getFile?file_id={file_id}") file_json = file_url.json()