20 lines
554 B
Python
20 lines
554 B
Python
import os
|
|
from celery import Celery
|
|
from celery.schedules import crontab
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
|
|
|
|
app = Celery("Gallery Archiver")
|
|
|
|
app.config_from_object("django.conf:settings", namespace="CELERY")
|
|
|
|
# Configure beat schedule
|
|
app.conf.beat_schedule = {
|
|
"auth.flush_expired_tokens": {
|
|
"task": "api.authentication.tasks.flush_expired_tokens",
|
|
"schedule": crontab(hour="2", minute="0"), # Daily at 2:00 AM
|
|
},
|
|
}
|
|
|
|
# Load task modules from all registered Django apps.
|
|
app.autodiscover_tasks()
|