From 97634bb36afeec6046ab6109a9669b685357986e Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sun, 25 May 2014 23:34:27 +0200 Subject: [PATCH] add celery app to project --- gnuviechadmin/gnuviechadmin/__init__.py | 1 + gnuviechadmin/gnuviechadmin/celery.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 gnuviechadmin/gnuviechadmin/celery.py diff --git a/gnuviechadmin/gnuviechadmin/__init__.py b/gnuviechadmin/gnuviechadmin/__init__.py index e69de29..bd9391f 100644 --- a/gnuviechadmin/gnuviechadmin/__init__.py +++ b/gnuviechadmin/gnuviechadmin/__init__.py @@ -0,0 +1 @@ +from gnuviechadmin.celery import app as celery_app diff --git a/gnuviechadmin/gnuviechadmin/celery.py b/gnuviechadmin/gnuviechadmin/celery.py new file mode 100644 index 0000000..5a48fbf --- /dev/null +++ b/gnuviechadmin/gnuviechadmin/celery.py @@ -0,0 +1,21 @@ +from __future__ import absolute_import + +import os + +from celery import Celery + +from django.conf import settings + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', + 'gnuviechadmin.settings.production') + + +app = Celery('gnuviechadmin') + +app.config_from_object('django.conf:settings') +app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) + + +@app.task(bind=True) +def debug_task(self): + print('Request: {0!r}'.format(self.request))