From 34df5a32d2604e3c3d7ff0d74d8cf779003defe4 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Thu, 30 Apr 2015 16:02:10 -0400 Subject: [PATCH] Get LMS tests passing. --- lms/__init__.py | 5 +++++ lms/celery.py | 17 +++++++++++++++++ lms/envs/bok_choy.py | 3 ++- lms/envs/test.py | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 lms/celery.py diff --git a/lms/__init__.py b/lms/__init__.py index e69de29bb2..b64e43e83b 100644 --- a/lms/__init__.py +++ b/lms/__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/lms/celery.py b/lms/celery.py new file mode 100644 index 0000000000..fc8bd655bf --- /dev/null +++ b/lms/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/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index 75e66f4215..f60ff4d089 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -56,7 +56,8 @@ MEDIA_URL = "/static/uploads/" CELERY_ALWAYS_EAGER = True CELERY_RESULT_BACKEND = 'cache' -BROKER_TRANSPORT = 'memory' +CELERY_CACHE_BACKEND = 'memory' +#BROKER_TRANSPORT = 'memory' ###################### Grade Downloads ###################### GRADES_DOWNLOAD = { diff --git a/lms/envs/test.py b/lms/envs/test.py index ff0946b288..c9ee4e6153 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -300,6 +300,7 @@ GIT_REPO_DIR = TEST_ROOT / "course_repos" CELERY_ALWAYS_EAGER = True CELERY_RESULT_BACKEND = 'cache' +CELERY_CACHE_BACKEND = 'memory' BROKER_TRANSPORT = 'memory' ######################### MARKETING SITE ###############################