diff --git a/common/djangoapps/util/course.py b/common/djangoapps/util/course.py index abef18a3263d..f438894f75de 100644 --- a/common/djangoapps/util/course.py +++ b/common/djangoapps/util/course.py @@ -53,7 +53,10 @@ def get_link_for_about_page(course): ).get('CUSTOM_COURSE_URLS') if use_catalog_mfe(): - about_base_url = settings.CATALOG_MICROFRONTEND_URL + about_base_url = configuration_helpers.get_value( + 'CATALOG_MICROFRONTEND_URL', + settings.CATALOG_MICROFRONTEND_URL, + ) else: about_base_url = configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL) diff --git a/lms/djangoapps/branding/views.py b/lms/djangoapps/branding/views.py index 33c5813f16ff..b98b652ce5d7 100644 --- a/lms/djangoapps/branding/views.py +++ b/lms/djangoapps/branding/views.py @@ -28,6 +28,19 @@ log = logging.getLogger(__name__) +def _catalog_mfe_base_url() -> str: + """ + Return the site-aware base URL for the Catalog MFE. + + Reads `CATALOG_MICROFRONTEND_URL` from Site Configuration when available; + otherwise falls back to `settings.CATALOG_MICROFRONTEND_URL`. + """ + return configuration_helpers.get_value( + 'CATALOG_MICROFRONTEND_URL', + settings.CATALOG_MICROFRONTEND_URL, + ) + + @ensure_csrf_cookie @transaction.non_atomic_requests @cache_if_anonymous() @@ -46,7 +59,10 @@ def index(request): return redirect('dashboard') if use_catalog_mfe(): - return redirect(f'{settings.CATALOG_MICROFRONTEND_URL}/', permanent=True) + return redirect( + f'{_catalog_mfe_base_url()}/', + permanent=True, + ) enable_mktg_site = configuration_helpers.get_value( 'ENABLE_MKTG_SITE', @@ -94,7 +110,10 @@ def courses(request): profile page. Otherwise, it's the edX courseware.views.views.courses page """ if use_catalog_mfe(): - return redirect(f'{settings.CATALOG_MICROFRONTEND_URL}/courses', permanent=True) + return redirect( + f'{_catalog_mfe_base_url()}/', + permanent=True, + ) enable_mktg_site = configuration_helpers.get_value( 'ENABLE_MKTG_SITE', diff --git a/lms/djangoapps/learner_home/serializers.py b/lms/djangoapps/learner_home/serializers.py index f7eed25d22e9..daac3a29ecc3 100644 --- a/lms/djangoapps/learner_home/serializers.py +++ b/lms/djangoapps/learner_home/serializers.py @@ -14,6 +14,7 @@ from common.djangoapps.course_modes.models import CourseMode from openedx.features.course_experience import course_home_url +from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from xmodule.data import CertificatesDisplayBehaviors from lms.djangoapps.learner_home.utils import course_progress_url @@ -595,8 +596,10 @@ class EnterpriseDashboardSerializer(serializers.Serializer): def get_url(self, instance): return urljoin( - settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL, - instance["slug"], + configuration_helpers.get_value( + 'ENTERPRISE_LEARNER_PORTAL_BASE_URL', + settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL, + ), ) diff --git a/lms/djangoapps/learner_home/views.py b/lms/djangoapps/learner_home/views.py index 40962721b339..9b3a2984c7dd 100644 --- a/lms/djangoapps/learner_home/views.py +++ b/lms/djangoapps/learner_home/views.py @@ -73,8 +73,12 @@ def get_platform_settings(): """Get settings used for platform level connections: emails, url routes, etc.""" course_search_url = marketing_link("COURSES") + catalog_microfrontend_url = configuration_helpers.get_value( + "CATALOG_MICROFRONTEND_URL", + settings.CATALOG_MICROFRONTEND_URL, + ) if toggles.use_catalog_mfe(): - course_search_url = f"{settings.CATALOG_MICROFRONTEND_URL}/courses" + course_search_url = f"{catalog_microfrontend_url}/courses" return { "supportEmail": settings.DEFAULT_FEEDBACK_EMAIL, diff --git a/lms/djangoapps/program_enrollments/management/commands/send_program_course_nudge_email.py b/lms/djangoapps/program_enrollments/management/commands/send_program_course_nudge_email.py index af2bfdca752d..80c63a6f32bc 100644 --- a/lms/djangoapps/program_enrollments/management/commands/send_program_course_nudge_email.py +++ b/lms/djangoapps/program_enrollments/management/commands/send_program_course_nudge_email.py @@ -23,6 +23,7 @@ from openedx.core.constants import COURSE_PUBLISHED from openedx.core.djangoapps.catalog.utils import get_programs from openedx.core.djangoapps.programs.utils import ProgramProgressMeter +from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.features.enterprise_support.api import get_enterprise_learner_data_from_db User = get_user_model() @@ -190,7 +191,10 @@ def emit_event(self, user, program, suggested_course_run, suggested_course, comp if enterprise_customer and enterprise_customer['enable_learner_portal']: # If user is an enterprise learner then we want to redirect to B2B course landing page on learner portal. recommended_course_url = urljoin( - settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL, + configuration_helpers.get_value( + 'ENTERPRISE_LEARNER_PORTAL_BASE_URL', + settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL, + ), '/'.join([enterprise_customer['slug'], 'course', suggested_course['key']]), ) else: diff --git a/lms/templates/header/navbar-logo-header.html b/lms/templates/header/navbar-logo-header.html index adb12deec16f..9c0ae62b23a0 100644 --- a/lms/templates/header/navbar-logo-header.html +++ b/lms/templates/header/navbar-logo-header.html @@ -20,7 +20,7 @@