Commit bf754c86 by Han Su Kim

Merge pull request #2848 from antoviaque/xblock-mentoring-optionalapp-fix

Only add mentoring application to INSTALLED_APPS when in virtualenv
parents b3ac3b6f 76ae57c7
...@@ -24,6 +24,7 @@ Longer TODO: ...@@ -24,6 +24,7 @@ Longer TODO:
# want to import all variables from base settings files # want to import all variables from base settings files
# pylint: disable=W0401, W0611, W0614 # pylint: disable=W0401, W0611, W0614
import imp
import sys import sys
import lms.envs.common import lms.envs.common
from lms.envs.common import ( from lms.envs.common import (
...@@ -34,7 +35,8 @@ from path import path ...@@ -34,7 +35,8 @@ from path import path
from lms.lib.xblock.mixin import LmsBlockMixin from lms.lib.xblock.mixin import LmsBlockMixin
from cms.lib.xblock.mixin import CmsBlockMixin from cms.lib.xblock.mixin import CmsBlockMixin
from xmodule.modulestore.inheritance import InheritanceMixin from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.x_module import XModuleMixin, prefer_xmodules from xmodule.modulestore import prefer_xmodules
from xmodule.x_module import XModuleMixin
from dealer.git import git from dealer.git import git
############################ FEATURE CONFIGURATION ############################# ############################ FEATURE CONFIGURATION #############################
...@@ -467,9 +469,6 @@ INSTALLED_APPS = ( ...@@ -467,9 +469,6 @@ INSTALLED_APPS = (
# for course creator table # for course creator table
'django.contrib.admin', 'django.contrib.admin',
# XBlocks containing migrations
'mentoring',
# for managing course modes # for managing course modes
'course_modes', 'course_modes',
...@@ -536,11 +535,22 @@ MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 5 ...@@ -536,11 +535,22 @@ MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 5
MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60 MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60
### JSdraw (only installed in some instances) ### Apps only installed in some instances
OPTIONAL_APPS = (
'edx_jsdraw',
'mentoring',
)
try: for app_name in OPTIONAL_APPS:
import edx_jsdraw # First attempt to only find the module rather than actually importing it,
except ImportError: # to avoid circular references - only try to import if it can't be found
pass # by find_module, which doesn't work with import hooks
else: try:
INSTALLED_APPS += ('edx_jsdraw',) imp.find_module(app_name)
except ImportError:
try:
__import__(app_name)
except ImportError:
continue
INSTALLED_APPS += (app_name,)
...@@ -26,6 +26,7 @@ Longer TODO: ...@@ -26,6 +26,7 @@ Longer TODO:
import sys import sys
import os import os
import imp
import json import json
from path import path from path import path
...@@ -34,7 +35,8 @@ from .discussionsettings import * ...@@ -34,7 +35,8 @@ from .discussionsettings import *
from lms.lib.xblock.mixin import LmsBlockMixin from lms.lib.xblock.mixin import LmsBlockMixin
from xmodule.modulestore.inheritance import InheritanceMixin from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.x_module import XModuleMixin, prefer_xmodules from xmodule.modulestore import prefer_xmodules
from xmodule.x_module import XModuleMixin
################################### FEATURES ################################### ################################### FEATURES ###################################
# The display name of the platform to be used in templates/emails/etc. # The display name of the platform to be used in templates/emails/etc.
...@@ -1163,9 +1165,6 @@ INSTALLED_APPS = ( ...@@ -1163,9 +1165,6 @@ INSTALLED_APPS = (
'reverification', 'reverification',
'embargo', 'embargo',
# XBlocks containing migrations
'mentoring',
) )
######################### MARKETING SITE ############################### ######################### MARKETING SITE ###############################
...@@ -1447,11 +1446,22 @@ ALL_LANGUAGES = ( ...@@ -1447,11 +1446,22 @@ ALL_LANGUAGES = (
) )
### JSdraw (only installed in some instances) ### Apps only installed in some instances
OPTIONAL_APPS = (
'edx_jsdraw',
'mentoring',
)
try: for app_name in OPTIONAL_APPS:
import edx_jsdraw # First attempt to only find the module rather than actually importing it,
except ImportError: # to avoid circular references - only try to import if it can't be found
pass # by find_module, which doesn't work with import hooks
else: try:
INSTALLED_APPS += ('edx_jsdraw',) imp.find_module(app_name)
except ImportError:
try:
__import__(app_name)
except ImportError:
continue
INSTALLED_APPS += (app_name,)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment