From a2cc679b256fe3ce73ebcdf0d8e3bc9d3ae34a4e Mon Sep 17 00:00:00 2001 From: John Eskew Date: Thu, 2 Nov 2017 16:27:19 -0400 Subject: [PATCH 1/3] Remove usage of default_app_label from ccxcon. --- cms/envs/aws.py | 2 +- cms/envs/test.py | 2 +- cms/envs/yaml_config.py | 2 +- lms/envs/aws.py | 2 +- lms/envs/test.py | 2 +- lms/envs/yaml_config.py | 2 +- openedx/core/djangoapps/ccxcon/__init__.py | 2 -- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 855543d463..999a05c026 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -503,7 +503,7 @@ JWT_AUTH.update(ENV_TOKENS.get('JWT_AUTH', {})) ######################## CUSTOM COURSES for EDX CONNECTOR ###################### if FEATURES.get('CUSTOM_COURSES_EDX'): - INSTALLED_APPS.append('openedx.core.djangoapps.ccxcon') + INSTALLED_APPS.append('openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig') # Partner support link for CMS footer PARTNER_SUPPORT_EMAIL = ENV_TOKENS.get('PARTNER_SUPPORT_EMAIL', PARTNER_SUPPORT_EMAIL) diff --git a/cms/envs/test.py b/cms/envs/test.py index 86e4312906..f620823303 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -331,7 +331,7 @@ FEATURES['ENABLE_TEAMS'] = True SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd' ######### custom courses ######### -INSTALLED_APPS.append('openedx.core.djangoapps.ccxcon') +INSTALLED_APPS.append('openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig') FEATURES['CUSTOM_COURSES_EDX'] = True # API access management -- needed for simple-history to run. diff --git a/cms/envs/yaml_config.py b/cms/envs/yaml_config.py index 1def36ef06..b8861d32ac 100644 --- a/cms/envs/yaml_config.py +++ b/cms/envs/yaml_config.py @@ -259,7 +259,7 @@ BROKER_USE_SSL = ENV_TOKENS.get('CELERY_BROKER_USE_SSL', False) ######################## CUSTOM COURSES for EDX CONNECTOR ###################### if FEATURES.get('CUSTOM_COURSES_EDX'): - INSTALLED_APPS.append('openedx.core.djangoapps.ccxcon') + INSTALLED_APPS.append('openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig') ########################## Extra middleware classes ####################### diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 7be1753a7c..e9e61a4db3 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -823,7 +823,7 @@ ECOMMERCE_SERVICE_WORKER_USERNAME = ENV_TOKENS.get( ##### Custom Courses for EdX ##### if FEATURES.get('CUSTOM_COURSES_EDX'): - INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon'] + INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig'] MODULESTORE_FIELD_OVERRIDE_PROVIDERS += ( 'lms.djangoapps.ccx.overrides.CustomCoursesForEdxOverrideProvider', ) diff --git a/lms/envs/test.py b/lms/envs/test.py index d683b05c47..a86d172590 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -552,7 +552,7 @@ FACEBOOK_APP_ID = "Test" FACEBOOK_API_VERSION = "v2.8" ######### custom courses ######### -INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon'] +INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig'] FEATURES['CUSTOM_COURSES_EDX'] = True # Set dummy values for profile image settings. diff --git a/lms/envs/yaml_config.py b/lms/envs/yaml_config.py index 83ed8b56b7..1bfc0df5f6 100644 --- a/lms/envs/yaml_config.py +++ b/lms/envs/yaml_config.py @@ -306,7 +306,7 @@ GRADES_DOWNLOAD_ROUTING_KEY = HIGH_MEM_QUEUE ##### Custom Courses for EdX ##### if FEATURES.get('CUSTOM_COURSES_EDX'): - INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon'] + INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig'] MODULESTORE_FIELD_OVERRIDE_PROVIDERS += ( 'lms.djangoapps.ccx.overrides.CustomCoursesForEdxOverrideProvider', ) diff --git a/openedx/core/djangoapps/ccxcon/__init__.py b/openedx/core/djangoapps/ccxcon/__init__.py index 9a97524877..98a839e469 100644 --- a/openedx/core/djangoapps/ccxcon/__init__.py +++ b/openedx/core/djangoapps/ccxcon/__init__.py @@ -6,5 +6,3 @@ that is used to interact with the CCX and their master courses. The ccxcon app needs to be placed in `openedx.core.djangoapps` because it will be used both in CMS and LMS. """ - -default_app_config = 'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig' From 3f99fe4c1bc4d28ad99a4efed397201700e79e15 Mon Sep 17 00:00:00 2001 From: John Eskew Date: Thu, 2 Nov 2017 16:39:30 -0400 Subject: [PATCH 2/3] Move bookmarks startup.py over to AppConfig::ready --- cms/envs/common.py | 2 +- lms/envs/common.py | 2 +- openedx/core/djangoapps/bookmarks/apps.py | 16 ++++++++++++++++ openedx/core/djangoapps/bookmarks/startup.py | 5 ----- 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 openedx/core/djangoapps/bookmarks/apps.py delete mode 100644 openedx/core/djangoapps/bookmarks/startup.py diff --git a/cms/envs/common.py b/cms/envs/common.py index 0e3caa4979..e9bad5cd99 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -939,7 +939,7 @@ INSTALLED_APPS = [ 'openedx.core.djangoapps.service_status', # Bookmarks - 'openedx.core.djangoapps.bookmarks', + 'openedx.core.djangoapps.bookmarks.apps.BookmarksConfig', # Video module configs (This will be moved to Video once it becomes an XBlock) 'openedx.core.djangoapps.video_config', diff --git a/lms/envs/common.py b/lms/envs/common.py index 378680e1f6..a68975b3b1 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2076,7 +2076,7 @@ INSTALLED_APPS = [ 'openedx.core.djangoapps.video_config', # Bookmarks - 'openedx.core.djangoapps.bookmarks', + 'openedx.core.djangoapps.bookmarks.apps.BookmarksConfig', # Our courseware 'courseware', diff --git a/openedx/core/djangoapps/bookmarks/apps.py b/openedx/core/djangoapps/bookmarks/apps.py new file mode 100644 index 0000000000..b0ab511bf8 --- /dev/null +++ b/openedx/core/djangoapps/bookmarks/apps.py @@ -0,0 +1,16 @@ +""" +Configuration for bookmarks Django app +""" +from django.apps import AppConfig + + +class BookmarksConfig(AppConfig): + """ + Configuration class for bookmarks Django app + """ + name = 'openedx.core.djangoapps.bookmarks' + verbose_name = "Bookmarks" + + def ready(self): + # Register the signals handled by bookmarks. + from . import signals diff --git a/openedx/core/djangoapps/bookmarks/startup.py b/openedx/core/djangoapps/bookmarks/startup.py deleted file mode 100644 index d3867d383c..0000000000 --- a/openedx/core/djangoapps/bookmarks/startup.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -Setup the signals on startup. -""" - -from . import signals # pylint: disable=unused-import From d6f87720311f1b8d30a6ce36231842c90a0eb464 Mon Sep 17 00:00:00 2001 From: John Eskew Date: Thu, 2 Nov 2017 16:46:53 -0400 Subject: [PATCH 3/3] Move course_overviews startup.py over to AppConfig::ready --- cms/envs/common.py | 18 +++++++++--------- lms/envs/common.py | 18 +++++++++--------- .../content/course_overviews/apps.py | 17 +++++++++++++++++ .../content/course_overviews/startup.py | 5 ----- 4 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 openedx/core/djangoapps/content/course_overviews/apps.py delete mode 100644 openedx/core/djangoapps/content/course_overviews/startup.py diff --git a/cms/envs/common.py b/cms/envs/common.py index e9bad5cd99..8768ac7055 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1015,7 +1015,7 @@ INSTALLED_APPS = [ # Additional problem types 'edx_jsme', # Molecular Structure - 'openedx.core.djangoapps.content.course_overviews', + 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig', 'openedx.core.djangoapps.content.course_structures.apps.CourseStructuresConfig', 'openedx.core.djangoapps.content.block_structure.apps.BlockStructureConfig', @@ -1188,19 +1188,19 @@ MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60 # that this app should be inserted *before*. A None here means it should be appended to the list. OPTIONAL_APPS = ( ('mentoring', None), - ('problem_builder', 'openedx.core.djangoapps.content.course_overviews'), + ('problem_builder', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), ('edx_sga', None), # edx-ora2 - ('submissions', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.assessment', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.fileupload', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.workflow', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.xblock', 'openedx.core.djangoapps.content.course_overviews'), + ('submissions', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.assessment', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.fileupload', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.workflow', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.xblock', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), # edxval - ('edxval', 'openedx.core.djangoapps.content.course_overviews'), + ('edxval', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), # Organizations App (http://github.com/edx/edx-organizations) ('organizations', None), diff --git a/lms/envs/common.py b/lms/envs/common.py index a68975b3b1..c575cff276 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2221,7 +2221,7 @@ INSTALLED_APPS = [ 'lms.djangoapps.lms_xblock', # Course data caching - 'openedx.core.djangoapps.content.course_overviews', + 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig', 'openedx.core.djangoapps.content.course_structures.apps.CourseStructuresConfig', 'openedx.core.djangoapps.content.block_structure.apps.BlockStructureConfig', 'lms.djangoapps.course_blocks', @@ -2883,19 +2883,19 @@ ALL_LANGUAGES = [ # that this app should be inserted *before*. A None here means it should be appended to the list. OPTIONAL_APPS = [ ('mentoring', None), - ('problem_builder', 'openedx.core.djangoapps.content.course_overviews'), + ('problem_builder', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), ('edx_sga', None), # edx-ora2 - ('submissions', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.assessment', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.fileupload', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.workflow', 'openedx.core.djangoapps.content.course_overviews'), - ('openassessment.xblock', 'openedx.core.djangoapps.content.course_overviews'), + ('submissions', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.assessment', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.fileupload', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.workflow', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), + ('openassessment.xblock', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), # edxval - ('edxval', 'openedx.core.djangoapps.content.course_overviews'), + ('edxval', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'), # edX Proctoring ('edx_proctoring', None), diff --git a/openedx/core/djangoapps/content/course_overviews/apps.py b/openedx/core/djangoapps/content/course_overviews/apps.py new file mode 100644 index 0000000000..f972abab03 --- /dev/null +++ b/openedx/core/djangoapps/content/course_overviews/apps.py @@ -0,0 +1,17 @@ +""" +Configuration for course_overviews Django app +""" +from django.apps import AppConfig + + +class CourseOverviewsConfig(AppConfig): + """ + Configuration class for course_overviews Django app + """ + name = 'openedx.core.djangoapps.content.course_overviews' + verbose_name = "Course Overviews" + + def ready(self): + # Import signals to activate signal handler which invalidates + # the CourseOverview cache every time a course is published. + from . import signals # pylint: disable=unused-import diff --git a/openedx/core/djangoapps/content/course_overviews/startup.py b/openedx/core/djangoapps/content/course_overviews/startup.py deleted file mode 100644 index 8ec2e71004..0000000000 --- a/openedx/core/djangoapps/content/course_overviews/startup.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Code run at server start up to initialize the course_overviews app.""" - -# Importing signals is necessary to activate signal handler, which invalidates -# the CourseOverview cache every time a course is published. -import openedx.core.djangoapps.content.course_overviews.signals # pylint: disable=unused-import