mirror of
https://github.com/fergalmoran/dss.api.git
synced 2025-12-22 09:18:13 +00:00
25 lines
686 B
Python
25 lines
686 B
Python
from __future__ import absolute_import
|
|
|
|
import os
|
|
|
|
from celery import Celery
|
|
|
|
# set the default Django settings module for the 'celery' program.
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dss.settings')
|
|
|
|
from django.conf import settings
|
|
|
|
app = Celery('dss')
|
|
|
|
# Using a string here means the worker will not have to
|
|
# pickle the object when using Windows.
|
|
app.config_from_object('django.conf:settings')
|
|
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
|
|
|
"""
|
|
@app.on_after_configure.connect
|
|
def setup_periodic_tasks(sender, **kwargs):
|
|
# Calls test('hello') every 10 seconds.
|
|
sender.add_periodic_task(10.0, tasks.play_pending_audio.s('hello'), name='add every 10')
|
|
"""
|