From 27223ae80f73f693859f542d9406a45f5bc70d00 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Thu, 30 Apr 2015 17:50:18 -0400 Subject: [PATCH] Load celery for CMS as well. --- cms/__init__.py | 5 +++++ cms/celery.py | 17 +++++++++++++++++ cms/envs/test.py | 2 +- lms/envs/bok_choy.py | 1 - lms/envs/test.py | 1 - 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 cms/celery.py diff --git a/cms/__init__.py b/cms/__init__.py index e69de29bb2..b64e43e83b 100644 --- a/cms/__init__.py +++ b/cms/__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 diff --git a/cms/celery.py b/cms/celery.py new file mode 100644 index 0000000000..fc8bd655bf --- /dev/null +++ b/cms/celery.py @@ -0,0 +1,17 @@ +from __future__ import absolute_import + +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', 'proj.settings') + +app = Celery('proj') + +# 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) diff --git a/cms/envs/test.py b/cms/envs/test.py index 2d10aaad49..14d0d15b2c 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -188,7 +188,7 @@ simplefilter('ignore') CELERY_ALWAYS_EAGER = True CELERY_RESULT_BACKEND = 'cache' -BROKER_TRANSPORT = 'memory' +CELERY_CACHE_BACKEND = 'memory' ########################### Server Ports ################################### diff --git a/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index f60ff4d089..eec91a2cb0 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -57,7 +57,6 @@ MEDIA_URL = "/static/uploads/" CELERY_ALWAYS_EAGER = True CELERY_RESULT_BACKEND = 'cache' CELERY_CACHE_BACKEND = 'memory' -#BROKER_TRANSPORT = 'memory' ###################### Grade Downloads ###################### GRADES_DOWNLOAD = { diff --git a/lms/envs/test.py b/lms/envs/test.py index c9ee4e6153..f612232c5f 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -301,7 +301,6 @@ GIT_REPO_DIR = TEST_ROOT / "course_repos" CELERY_ALWAYS_EAGER = True CELERY_RESULT_BACKEND = 'cache' CELERY_CACHE_BACKEND = 'memory' -BROKER_TRANSPORT = 'memory' ######################### MARKETING SITE ###############################