28 lines
630 B
Python
28 lines
630 B
Python
import os
|
|
from datetime import timedelta
|
|
|
|
from celery import Celery
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'poizonstore.settings')
|
|
|
|
app = Celery('poizonstore')
|
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
app.autodiscover_tasks()
|
|
|
|
app.conf.beat_schedule = {
|
|
'update-cdek-status-every-hour': {
|
|
'task': 'store.tasks.schedule_cdek_status_update',
|
|
'schedule': timedelta(hours=1),
|
|
},
|
|
|
|
'update-yuan-rate-every-hour': {
|
|
'task': 'store.tasks.update_yuan_rate',
|
|
'schedule': timedelta(hours=1),
|
|
},
|
|
}
|
|
|
|
|
|
@app.task()
|
|
def debug_task():
|
|
print(f'Task complete')
|