Compare commits
2 Commits
90aeac1807
...
a6a644d801
| Author | SHA1 | Date | |
|---|---|---|---|
| a6a644d801 | |||
|
|
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 = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user