mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-27 22:03:58 +00:00
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
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 13m45s
This commit is contained in:
22
apibase/celery.py
Normal file
22
apibase/celery.py
Normal 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}")
|
Reference in New Issue
Block a user