From f861c19da24f6dbb5fd9ab90cadd1a193c77dc07 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Tue, 17 Dec 2024 17:42:11 -0500 Subject: [PATCH] fix: Force djangoapps to be loaded before we run webpack. In the specific case of webworkers for proctoring, we need to force Django to load before we run `npm run webpack` so that the file ../workers.json gets written. See https://github.com/openedx/edx-proctoring/blob/73c7f55e2be91324fa07fec6e6ac0a667fdd8412/edx_proctoring/apps.py#L46 Also adds JS_ENV_EXTRA_CONFIG, which is required to create the webworker config. --- .../roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index 33592a41604..369a0d997bb 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -3,13 +3,15 @@ export WEBPACK_CONFIG_PATH=webpack.prod.config.js export STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles export STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio +export JS_ENV_EXTRA_CONFIG={} {% if edxapp_staticfiles_storage_overrides %} {% for override in edxapp_staticfiles_storage_overrides %} export STATICFILES_STORAGE={{ override | quote }} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - npm run webpack \ + {{ edxapp_venv_bin }} python manage.py lms --settings=$EDX_PLATFORM_SETTINGS print_setting STATIC_ROOT WEBPACK_CONFIG_PATH \ + && npm run webpack \ && npm run compile-sass -- --theme-dir /edx/var/edx-themes/edx-themes/edx-platform --theme-dir /edx/app/edxapp/edx-platform/themes \ && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS @@ -17,7 +19,8 @@ sudo -E -H -u {{ edxapp_user }} \ {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - npm run webpack \ + {{ edxapp_venv_bin }} python manage.py lms --settings=$EDX_PLATFORM_SETTINGS print_setting STATIC_ROOT WEBPACK_CONFIG_PATH \ + && npm run webpack \ && npm run compile-sass -- --theme-dir /edx/var/edx-themes/edx-themes/edx-platform --theme-dir /edx/app/edxapp/edx-platform/themes \ && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS