Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: course outline not found issue for ccx courses #36128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,11 +771,19 @@ def get_env_setting(setting):
XBLOCK_SETTINGS.setdefault("VideoBlock", {})['YOUTUBE_API_KEY'] = AUTH_TOKENS.get('YOUTUBE_API_KEY', YOUTUBE_API_KEY)

##### Custom Courses for EdX #####
if FEATURES.get('CUSTOM_COURSES_EDX'):
INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig']
if FEATURES['CUSTOM_COURSES_EDX']:
INSTALLED_APPS += [
'lms.djangoapps.ccx',
'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig',
'cms.djangoapps.contentstore.apps.ContentstoreConfig',
'openedx.core.djangoapps.content.search',
'openedx.core.djangoapps.content_staging',
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to understand this better.

First of all, you're only adding 3 new apps here, right?

  • ContentstoreConfig
  • search
  • content-staging

How is it that these aren't running already? Why does the CCX feature need them turned on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that a CCX course is created from LMS. All the above apps are already defined in CMS. The course publishing signals are not triggered in LMS until we define cms.djangoapps.contentstore.apps.ContentstoreConfig in our INSTALLED_APPS in LMS. The last 2 apps (openedx.core.djangoapps.content.search and openedx.core.djangoapps.content_staging) are required to be defined as they are being used in the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you determine that these were the minimal required apps to add from CMS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We needed to ensure that signals were triggered when creating a CCX course. When I added ContentstoreConfig to INSTALLED_APPS, I ran into this error:
RuntimeError: Model class openedx.core.djangoapps.content.search.models.SearchAccess doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

After some debugging, I found that ContentstoreConfig depends on the search app, which wasn't listed in INSTALLED_APPS for LMS. Adding search fixed the issue, and the course outline started publishing.

However, I then saw another error in the logs when the course publish signals were triggered:
RuntimeError: Model class openedx.core.djangoapps.content_staging.models.StagedContent doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Adding content_staging to INSTALLED_APPS resolved this, and everything worked without errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We needed to ensure that signals were triggered when creating a CCX course.

Tying this into my other comment, is it possible to add a test for triggering signals?


MODULESTORE_FIELD_OVERRIDE_PROVIDERS += (
'lms.djangoapps.ccx.overrides.CustomCoursesForEdxOverrideProvider',
)
COURSE_IMPORT_EXPORT_STORAGE = DEFAULT_FILE_STORAGE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We included cms.djangoapps.contentstore.apps.ContentstoreConfig in the INSTALLED_APPS of the LMS to ensure the app is properly loaded and our course publish signals are triggered properly. The app relies on the COURSE_IMPORT_EXPORT_STORAGE setting, which must be defined in the LMS configuration.

Failure to define this setting results in an error, as demonstrated in this related build log.


##### Individual Due Date Extensions #####
if FEATURES.get('INDIVIDUAL_DUE_DATES'):
Expand Down
10 changes: 9 additions & 1 deletion lms/envs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,16 @@
FACEBOOK_API_VERSION = "v2.8"

######### custom courses #########
INSTALLED_APPS += ['lms.djangoapps.ccx', 'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig']
INSTALLED_APPS += [
'lms.djangoapps.ccx',
'openedx.core.djangoapps.ccxcon.apps.CCXConnectorConfig',
'cms.djangoapps.contentstore.apps.ContentstoreConfig',
'openedx.core.djangoapps.content.search',
'openedx.core.djangoapps.content_staging',
]

FEATURES['CUSTOM_COURSES_EDX'] = True
COURSE_IMPORT_EXPORT_STORAGE = 'django.core.files.storage.FileSystemStorage'

# Set dummy values for profile image settings.
PROFILE_IMAGE_BACKEND = {
Expand Down
Loading