supscriptions
This commit is contained in:
27
TWB/celery.py
Executable file
27
TWB/celery.py
Executable file
@@ -0,0 +1,27 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
from celery.schedules import crontab
|
||||
from django.conf import settings
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TWB.settings")
|
||||
|
||||
app = Celery('bo', include=['TWB.tasks'])
|
||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
||||
|
||||
app.conf.beat_schedule = {
|
||||
'update-currency-rates': {
|
||||
'task': 'TWB.tasks.check_auto_subscribe',
|
||||
'schedule': crontab(minute=0, hour='*/1'),
|
||||
},
|
||||
'subscription_expiration_check': {
|
||||
'task': 'TWB.tasks.subscription_expiration_check',
|
||||
'schedule': crontab(hour=0, minute=0),
|
||||
# 'schedule': crontab(minute='*', hour='*'),
|
||||
},
|
||||
}
|
||||
|
||||
app.conf.broker_url = settings.CELERY_BROKER_URL
|
||||
Reference in New Issue
Block a user