diff options
Diffstat (limited to 'meetingtools')
-rw-r--r-- | meetingtools/__init__.py | 5 | ||||
-rw-r--r-- | meetingtools/celery.py | 24 |
2 files changed, 29 insertions, 0 deletions
diff --git a/meetingtools/__init__.py b/meetingtools/__init__.py index e69de29..46faaf4 100644 --- a/meetingtools/__init__.py +++ b/meetingtools/__init__.py @@ -0,0 +1,5 @@ +from __future__ import absolute_import + +# This will make sure the app is always imported when +# Django starts so that shared_task will use this app. +from .celery import app as celery_app
\ No newline at end of file diff --git a/meetingtools/celery.py b/meetingtools/celery.py new file mode 100644 index 0000000..21dd93d --- /dev/null +++ b/meetingtools/celery.py @@ -0,0 +1,24 @@ +from __future__ import absolute_import +# -*- coding: utf-8 -*- +__author__ = 'lundberg' + +import os +from celery import Celery +from django.conf import settings + +# set the default Django settings module for the 'celery' program. +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'meetingtools.settings') + +app = Celery('meetingtools', broker='amqp://guest@localhost//',) + +app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) + +# Optional configuration, see the application user guide. +app.conf.update( + CELERY_TASK_RESULT_EXPIRES=3600, + CELERY_TIMEZONE='Europe/Stockholm', + CELERY_ENABLE_UTC=True +) + +if __name__ == '__main__': + app.start()
\ No newline at end of file |