notification set up and celery configuration

This commit is contained in:
abutalib-kiwi
2023-07-19 16:24:53 +05:30
parent 2e7d36485c
commit 3223a2b050
10 changed files with 200 additions and 5 deletions

34
zod_bank/celery.py Normal file
View File

@ -0,0 +1,34 @@
"""
Celery Basic configuration
"""
# python imports
import os
# third party imports
from celery import Celery
from dotenv import load_dotenv
from celery.schedules import crontab
# OR, the same with increased verbosity:
load_dotenv(verbose=True)
env_path = os.path.join(os.path.abspath(os.path.join('.env', os.pardir)), '.env')
load_dotenv(dotenv_path=env_path)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', os.getenv('SETTINGS'))
# celery app
app = Celery()
app.config_from_object('django.conf:settings')
# Load task modules from all registered Django apps.
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
""" celery debug task """
print(f'Request: {self.request!r}')