From 165d5dcfd34267a70fcf6a2d8f1b7633e740b223 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Wed, 8 Aug 2012 16:13:43 -0400 Subject: [PATCH] add config files for running different server groups in dev --- lms/envs/devgroups/__init__.py | 0 lms/envs/devgroups/courses.py | 43 ++++++++++++++++++++++++++++++++++ lms/envs/devgroups/h_cs50.py | 3 +++ lms/envs/devgroups/m_6002.py | 3 +++ lms/envs/devgroups/portal.py | 13 ++++++++++ 5 files changed, 62 insertions(+) create mode 100644 lms/envs/devgroups/__init__.py create mode 100644 lms/envs/devgroups/courses.py create mode 100644 lms/envs/devgroups/h_cs50.py create mode 100644 lms/envs/devgroups/m_6002.py create mode 100644 lms/envs/devgroups/portal.py diff --git a/lms/envs/devgroups/__init__.py b/lms/envs/devgroups/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lms/envs/devgroups/courses.py b/lms/envs/devgroups/courses.py new file mode 100644 index 0000000000..bcaae70a99 --- /dev/null +++ b/lms/envs/devgroups/courses.py @@ -0,0 +1,43 @@ +from ..dev import * + +CLASSES_TO_DBS = { + 'BerkeleyX/CS169.1x/2012_Fall' : "cs169.db", + 'BerkeleyX/CS188.1x/2012_Fall' : "cs188_1.db", + 'HarvardX/CS50x/2012' : "cs50.db", + 'HarvardX/PH207x/2012_Fall' : "ph207.db", + 'MITx/3.091x/2012_Fall' : "3091.db", + 'MITx/6.002x/2012_Fall' : "6002.db", + 'MITx/6.00x/2012_Fall' : "600.db", +} + + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + 'KEY_FUNCTION': 'util.memcache.safe_key', + }, + 'general': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + 'KEY_PREFIX' : 'general', + 'VERSION' : 5, + 'KEY_FUNCTION': 'util.memcache.safe_key', + } +} + +SESSION_ENGINE = 'django.contrib.sessions.backends.cache' + + +def path_for_db(db_name): + return ENV_ROOT / "db" / db_name + +def course_db_for(course_id): + db_name = CLASSES_TO_DBS[course_id] + return { + 'default' : { + 'ENGINE' : 'django.db.backends.sqlite3', + 'NAME' : path_for_db(db_name) + } + } + diff --git a/lms/envs/devgroups/h_cs50.py b/lms/envs/devgroups/h_cs50.py new file mode 100644 index 0000000000..b838b1fdc3 --- /dev/null +++ b/lms/envs/devgroups/h_cs50.py @@ -0,0 +1,3 @@ +from .courses import * + +DATABASES = course_db_for('HarvardX/CS50x/2012') \ No newline at end of file diff --git a/lms/envs/devgroups/m_6002.py b/lms/envs/devgroups/m_6002.py new file mode 100644 index 0000000000..3d8feef764 --- /dev/null +++ b/lms/envs/devgroups/m_6002.py @@ -0,0 +1,3 @@ +from .courses import * + +DATABASES = course_db_for('MITx/6.002x/2012_Fall') \ No newline at end of file diff --git a/lms/envs/devgroups/portal.py b/lms/envs/devgroups/portal.py new file mode 100644 index 0000000000..b674218571 --- /dev/null +++ b/lms/envs/devgroups/portal.py @@ -0,0 +1,13 @@ +""" +Note that for this to work at all, you must have memcached running (or you won't +get shared sessions) +""" +from courses import * + +# Move this to a shared file later: +for class_id, db_name in CLASSES_TO_DBS.items(): + DATABASES[class_id] = { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': path_for_db(db_name) + } +