Merge pull request #16385 from edx/pwnage101/init_app_PLAT-1772
Add an lms_initialization app
This commit is contained in:
3
lms/djangoapps/lms_initialization/__init__.py
Normal file
3
lms/djangoapps/lms_initialization/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
Initialization app for the LMS
|
||||
"""
|
||||
32
lms/djangoapps/lms_initialization/apps.py
Normal file
32
lms/djangoapps/lms_initialization/apps.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Initialization app for the LMS
|
||||
|
||||
This app consists solely of a ready method in its AppConfig, and should be
|
||||
included early in the INSTALLED_APPS list.
|
||||
"""
|
||||
|
||||
import analytics
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class LMSInitializationConfig(AppConfig):
|
||||
"""
|
||||
Application Configuration for lms_initialization.
|
||||
"""
|
||||
name = 'lms_initialization'
|
||||
verbose_name = 'LMS Initialization'
|
||||
|
||||
def ready(self):
|
||||
"""
|
||||
Global LMS initialization methods are called here. This runs after
|
||||
settings have loaded, but before most other djangoapp initializations.
|
||||
"""
|
||||
self._initialize_analytics()
|
||||
|
||||
def _initialize_analytics(self):
|
||||
"""
|
||||
Initialize Segment analytics module by setting the write_key.
|
||||
"""
|
||||
if settings.LMS_SEGMENT_KEY:
|
||||
analytics.write_key = settings.LMS_SEGMENT_KEY
|
||||
@@ -2016,6 +2016,9 @@ INSTALLED_APPS = [
|
||||
'django.contrib.staticfiles',
|
||||
'djcelery',
|
||||
|
||||
# Initialization
|
||||
'lms_initialization.apps.LMSInitializationConfig',
|
||||
|
||||
# Common views
|
||||
'openedx.core.djangoapps.common_views',
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ settings.INSTALLED_APPS # pylint: disable=pointless-statement
|
||||
|
||||
from openedx.core.lib.django_startup import autostartup
|
||||
from openedx.core.release import doc_version
|
||||
import analytics
|
||||
|
||||
from openedx.core.djangoapps.monkey_patch import django_db_models_options
|
||||
|
||||
@@ -50,10 +49,6 @@ def run():
|
||||
# Mako requires the directories to be added after the django setup.
|
||||
microsite.enable_microsites(log)
|
||||
|
||||
# Initialize Segment analytics module by setting the write_key.
|
||||
if settings.LMS_SEGMENT_KEY:
|
||||
analytics.write_key = settings.LMS_SEGMENT_KEY
|
||||
|
||||
# register any dependency injections that we need to support in edx_proctoring
|
||||
# right now edx_proctoring is dependent on the openedx.core.djangoapps.credit and
|
||||
# lms.djangoapps.grades
|
||||
|
||||
Reference in New Issue
Block a user