Фикс ошибок по задачам
This commit is contained in:
parent
2367c7fae3
commit
a4a63bd31f
@ -0,0 +1,4 @@
|
|||||||
|
from .celery import app as celery_app
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ('celery_app',)
|
||||||
9
OneCprogsite/celery.py
Normal file
9
OneCprogsite/celery.py
Normal 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()
|
||||||
@ -70,9 +70,16 @@ if not DEBUG:
|
|||||||
LANGUAGE_COOKIE_HTTPONLY = True
|
LANGUAGE_COOKIE_HTTPONLY = True
|
||||||
LANGUAGE_COOKIE_SAMESITE = 'Lax'
|
LANGUAGE_COOKIE_SAMESITE = 'Lax'
|
||||||
|
|
||||||
# Redis
|
# Celery
|
||||||
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0')
|
CELERY_BROKER_URL = os.environ.get('REDIS_URL', 'redis://redis:6379/0')
|
||||||
CELERY_RESULT_BACKEND = os.environ.get('CELERY_RESULT_BACKEND', 'redis://localhost: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 = [
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
'https://nikdizell.ru',
|
'https://nikdizell.ru',
|
||||||
@ -100,6 +107,7 @@ INSTALLED_APPS = [
|
|||||||
'turnstile',
|
'turnstile',
|
||||||
'products',
|
'products',
|
||||||
'background_task',
|
'background_task',
|
||||||
|
'django_celery_results',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|||||||
@ -12,4 +12,7 @@ django-allauth
|
|||||||
django-simple-captcha
|
django-simple-captcha
|
||||||
django-turnstile
|
django-turnstile
|
||||||
celery
|
celery
|
||||||
django-background-tasks
|
django-background-tasks
|
||||||
|
celery>=5.3.0
|
||||||
|
redis>=5.0.0
|
||||||
|
django-celery-results>=2.5.0
|
||||||
Loading…
x
Reference in New Issue
Block a user