Фикс ошибок по задачам

This commit is contained in:
NikDizell 2026-06-19 18:29:44 +03:00
parent 2367c7fae3
commit a4a63bd31f
4 changed files with 28 additions and 4 deletions

View File

@ -0,0 +1,4 @@
from .celery import app as celery_app
__all__ = ('celery_app',)

9
OneCprogsite/celery.py Normal file
View File

@ -0,0 +1,9 @@
import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'OneCprogsite.settings')
app = Celery('OneCprogsite')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

View File

@ -70,9 +70,16 @@ if not DEBUG:
LANGUAGE_COOKIE_HTTPONLY = True
LANGUAGE_COOKIE_SAMESITE = 'Lax'
# Redis
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0')
CELERY_RESULT_BACKEND = os.environ.get('CELERY_RESULT_BACKEND', 'redis://localhost:6379/0')
# Celery
CELERY_BROKER_URL = os.environ.get('REDIS_URL', 'redis://redis:6379/0')
CELERY_RESULT_BACKEND = os.environ.get('REDIS_URL', 'redis://redis:6379/0')
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Europe/Moscow'
CELERY_TASK_TRACK_STARTED = True
CELERY_TASK_TIME_LIMIT = 30 * 60
CELERY_TASK_SOFT_TIME_LIMIT = 20 * 60
CSRF_TRUSTED_ORIGINS = [
'https://nikdizell.ru',
@ -100,6 +107,7 @@ INSTALLED_APPS = [
'turnstile',
'products',
'background_task',
'django_celery_results',
]
MIDDLEWARE = [

View File

@ -12,4 +12,7 @@ django-allauth
django-simple-captcha
django-turnstile
celery
django-background-tasks
django-background-tasks
celery>=5.3.0
redis>=5.0.0
django-celery-results>=2.5.0