

import os
from celery.schedules import crontab
from celery import Celery
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoproject.settings')

app = Celery('humari')
app.conf.enable_utc = False

app.conf.update(timezone = 'Asia/Kolkata')

app.config_from_object(settings, namespace='CELERY')

response = app.control.enable_events(reply=True)
print(response)

app.autodiscover_tasks()
 
@app.task(bind=True)
def debug_task(self):
    print(f"Request: {self.request!r}")




app.conf.beat_schedule = {
    'send-birthday-notifications-everyday': {
        'task': 'myapp.tasks.send_birthday_notifications_task',
        'schedule': crontab(hour=8, minute=00),
    },
    'send-birthday-wish': {
        'task': 'myapp.tasks.send_birthday_wish_mail',
        'schedule': crontab(hour=00, minute=5),
    },
}
