Only add mentoring application to INSTALLED_APPS when in virtualenv

This commit is contained in:
Xavier Antoviaque
2014-03-05 15:21:11 -04:00
committed by Calen Pennington
parent bdfd81d2f3
commit bde9513539
2 changed files with 38 additions and 20 deletions

View File

@@ -26,6 +26,7 @@ Longer TODO:
import sys
import os
import imp
import json
from path import path
@@ -1163,9 +1164,6 @@ INSTALLED_APPS = (
'reverification',
'embargo',
# XBlocks containing migrations
'mentoring',
)
######################### MARKETING SITE ###############################
@@ -1458,11 +1456,22 @@ ALL_LANGUAGES = (
)
### JSdraw (only installed in some instances)
### Apps only installed in some instances
try:
import edx_jsdraw
except ImportError:
pass
else:
INSTALLED_APPS += ('edx_jsdraw',)
OPTIONAL_APPS = (
'edx_jsdraw',
'mentoring',
)
for app_name in OPTIONAL_APPS:
# First attempt to only find the module rather than actually importing it,
# to avoid circular references - only try to import if it can't be found
# by find_module, which doesn't work with import hooks
try:
imp.find_module(app_name)
except ImportError:
try:
__import__(app_name)
except ImportError:
continue
INSTALLED_APPS += (app_name,)