redis broker and backend

This commit is contained in:
Jonas 12t 2021-11-03 19:24:03 +04:00
parent b5870cf12d
commit 40eb9c3ad2
3 changed files with 4 additions and 16 deletions

View File

@ -1,8 +1,2 @@
# Create your tasks here
from celery import shared_task
@shared_task
def add(x, y):
return x + y

View File

@ -35,15 +35,9 @@ app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
@app.task(bind=True)
def debug_task(self):
print(f'Request: {self.request}')
@app.task
def add(x, y):
return x + y
@app.task
def my_task():
print(connection.schema_name)
def add2(x, y):
return x + y

View File

@ -217,8 +217,8 @@ CELERY_TIMEZONE=os.environ.get('TIME_ZONE', 'UTC')
CELERY_TASK_TRACK_STARTED=True
CELERY_TASK_TIME_LIMIT=30 * 60
BROKER_URL=os.environ.get('CELERY_BROKER')
# CELERY_BROKER=os.environ.get('CELERY_BROKER')
# CELERY_BROKER_URL=os.environ.get('CELERY_BROKER')
RESULT_BACKEND=os.environ.get('CELERY_BROKER')
CELERY_RESULT_BACKEND=os.environ.get('CELERY_BACKEND')
# DJANGO_CELERY_BEAT_TZ_AWARE=False
# celery -A TiBillet worker -l INFO