Enhance environment variable handling, add Celery configuration, and implement device expiration notification tasks
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 13m45s

This commit is contained in:
2025-04-24 10:42:22 +05:00
parent ee8145f07f
commit 99982d13d5
8 changed files with 106 additions and 14 deletions

22
apibase/celery.py Normal file
View File

@ -0,0 +1,22 @@
import os
from celery import Celery
# Set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "apibase.settings")
app = Celery("apibase")
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object("django.conf:settings", namespace="CELERY")
# Load task modules from all registered Django apps.
app.autodiscover_tasks(["api", "devices"])
@app.task(bind=True, ignore_result=True)
def debug_task(self):
print(f"Request: {self.request!r}")