2024-10-20 21:57:12 +00:00
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
|
|
|
|
from celery import Celery
|
|
|
|
from celery import shared_task
|
2024-10-21 13:22:03 +00:00
|
|
|
from celery.schedules import crontab
|
2024-10-20 21:57:12 +00:00
|
|
|
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
app = Celery('mysite')
|
|
|
|
|
2024-10-21 13:22:03 +00:00
|
|
|
app.conf.beat_schedule = {
|
|
|
|
'periodical_servers_sync': {
|
|
|
|
'task': 'sync_all_servers',
|
|
|
|
'schedule': crontab(minute='*'),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-10-20 21:57:12 +00:00
|
|
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
|
|
|
|
|
|
app.autodiscover_tasks()
|
|
|
|
|