Importing Custom edx-platfrom

Hello Everyone,

I am trying to attempt to migrate my custom edx-platform repo to Tutor.
There are djangoapps and models added, so I would like to import it as it is.

I can confirm that there are no problems when imported to a running Lilac.2 installation.

However, when I create a new image using Tutor to import the edx-platform repo, I get the following error during the migrations phase.

I have noticed that there are errors coming from the /lms/djangoapps/program_enrollments/api/reading.py, however it is the same as Lilac.2 repo.

Error during quickstart

Creating tutor_local_mysql-job_run ... done
Initialising MySQL...
mysql: [Warning] Using a password on the command line interface can be insecure.
MySQL is up and running
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Initialising lms...
docker-compose -f /home/xxx/.local/share/tutor/env/local/docker-compose.yml -f /home/xxx/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/xxx/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

# Create waffle switches to enable some features, if they have not been explicitly defined before
# Completion tracking: add green ticks to every completed unit
(./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on
Creating tutor_local_lms-job_run ... done
2021/10/26 06:55:15 Waiting for: tcp://mysql:3306
2021/10/26 06:55:15 Connected to tcp://mysql:3306
Loading settings lms.envs.tutor.production
Traceback (most recent call last):
  File "./manage.py", line 120, in <module>
    startup.run()
  File "/openedx/edx-platform/lms/startup.py", line 20, in run
    django.setup()
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/pyenv/versions/3.8.6/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 50, in <module>
    _PSA_BACKENDS = {backend_class.name: backend_class for backend_class in _load_backend_classes()}
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 50, in <dictcomp>
    _PSA_BACKENDS = {backend_class.name: backend_class for backend_class in _load_backend_classes()}
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 47, in _load_backend_classes
    auth_class = module_member(class_path)
  File "/openedx/venv/lib/python3.8/site-packages/social_core/utils.py", line 61, in module_member
    module = import_module(mod)
  File "/openedx/venv/lib/python3.8/site-packages/social_core/utils.py", line 55, in import_module
    __import__(name)
  File "/openedx/edx-platform/import_shims/lms/third_party_auth/__init__.py", line 6, in <module>
    warn_deprecated_import('third_party_auth', 'common.djangoapps.third_party_auth')
  File "/openedx/edx-platform/import_shims/warn.py", line 37, in warn_deprecated_import
    raise DeprecatedEdxPlatformImportError(old_import, new_import)
import_shims.warn.DeprecatedEdxPlatformImportError: Importing third_party_auth instead of common.djangoapps.third_party_auth is deprecated
ERROR: 1
Error: Command failed with status 1: docker-compose -f /home/xxx/.local/share/tutor/env/local/docker-compose.yml -f /home/xxx/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/xxx/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

# Create waffle switches to enable some features, if they have not been explicitly defined before
# Completion tracking: add green ticks to every completed unit
(./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on

Error from the logs

2021-10-26 06:51:36,945 ERROR 1 [celery.utils.dispatch.signal] [user None] [ip None] signal.py:292 - Signal handler <bound method DjangoFixup.on_import_modules of <celery.fixups.django.DjangoFixup object at 0x7f3cddc21700>> raised: DeprecatedEdxPlatformImportError()
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/celery/utils/dispatch/signal.py", line 288, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 84, in on_import_modules
    self.worker_fixup.validate_models()
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 122, in validate_models
    self.django_setup()
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 118, in django_setup
    django.setup()
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/pyenv/versions/3.8.6/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 50, in <module>
    _PSA_BACKENDS = {backend_class.name: backend_class for backend_class in _load_backend_classes()}
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 50, in <dictcomp>
    _PSA_BACKENDS = {backend_class.name: backend_class for backend_class in _load_backend_classes()}
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 47, in _load_backend_classes
    auth_class = module_member(class_path)
  File "/openedx/venv/lib/python3.8/site-packages/social_core/utils.py", line 61, in module_member
    module = import_module(mod)
  File "/openedx/venv/lib/python3.8/site-packages/social_core/utils.py", line 55, in import_module
    __import__(name)
  File "/openedx/edx-platform/import_shims/lms/third_party_auth/__init__.py", line 6, in <module>
    warn_deprecated_import('third_party_auth', 'common.djangoapps.third_party_auth')
  File "/openedx/edx-platform/import_shims/warn.py", line 37, in warn_deprecated_import
    raise DeprecatedEdxPlatformImportError(old_import, new_import)
import_shims.warn.DeprecatedEdxPlatformImportError: Importing third_party_auth instead of common.djangoapps.third_party_auth is deprecated
2021-10-26 06:51:36,959 ERROR 1 [celery.utils.dispatch.signal] [user None] [ip None] signal.py:292 - Signal handler <promise@0x7f3cddc1e9d0 --> <bound method Celery._autodiscover_tasks of <Celery proj at 0x7f3cdc2edca0>>> raised: DeprecatedEdxPlatformImportError()
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/celery/utils/dispatch/signal.py", line 288, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/openedx/venv/lib/python3.8/site-packages/vine/promises.py", line 170, in __call__
    return self.throw()
  File "/openedx/venv/lib/python3.8/site-packages/vine/promises.py", line 167, in __call__
    retval = fun(*final_args, **final_kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/celery/app/base.py", line 664, in _autodiscover_tasks
    return self._autodiscover_tasks_from_fixups(related_name)
  File "/openedx/venv/lib/python3.8/site-packages/celery/app/base.py", line 673, in _autodiscover_tasks_from_fixups
    return self._autodiscover_tasks_from_names([
  File "/openedx/venv/lib/python3.8/site-packages/celery/app/base.py", line 668, in _autodiscover_tasks_from_names
    return self.loader.autodiscover_tasks(
  File "/openedx/venv/lib/python3.8/site-packages/celery/loaders/base.py", line 223, in autodiscover_tasks
    mod.__name__ for mod in autodiscover_tasks(packages or (),
  File "/openedx/venv/lib/python3.8/site-packages/celery/loaders/base.py", line 249, in autodiscover_tasks
    return [find_related_module(pkg, related_name) for pkg in packages]
  File "/openedx/venv/lib/python3.8/site-packages/celery/loaders/base.py", line 249, in <listcomp>
    return [find_related_module(pkg, related_name) for pkg in packages]
  File "/openedx/venv/lib/python3.8/site-packages/celery/loaders/base.py", line 270, in find_related_module
    return importlib.import_module(module_name)
  File "/opt/pyenv/versions/3.8.6/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/lms/djangoapps/instructor_task/tasks.py", line 33, in <module>
    from lms.djangoapps.instructor_task.tasks_helper.enrollments import upload_may_enroll_csv, upload_students_csv
  File "/openedx/edx-platform/lms/djangoapps/instructor_task/tasks_helper/enrollments.py", line 10, in <module>
    from lms.djangoapps.instructor_analytics.basic import enrolled_students_features, list_may_enroll
  File "/openedx/edx-platform/lms/djangoapps/instructor_analytics/basic.py", line 26, in <module>
    from lms.djangoapps.program_enrollments.api import fetch_program_enrollments_by_students
  File "/openedx/edx-platform/lms/djangoapps/program_enrollments/api/__init__.py", line 17, in <module>
    from .grades import iter_program_course_grades
  File "/openedx/edx-platform/lms/djangoapps/program_enrollments/api/grades.py", line 14, in <module>
    from .reading import fetch_program_course_enrollments
  File "/openedx/edx-platform/lms/djangoapps/program_enrollments/api/reading.py", line 13, in <module>
    from common.djangoapps.third_party_auth.models import SAMLProviderConfig
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 50, in <module>
    _PSA_BACKENDS = {backend_class.name: backend_class for backend_class in _load_backend_classes()}
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 50, in <dictcomp>
    _PSA_BACKENDS = {backend_class.name: backend_class for backend_class in _load_backend_classes()}
  File "/openedx/edx-platform/common/djangoapps/third_party_auth/models.py", line 47, in _load_backend_classes
    auth_class = module_member(class_path)
  File "/openedx/venv/lib/python3.8/site-packages/social_core/utils.py", line 61, in module_member
    module = import_module(mod)
  File "/openedx/venv/lib/python3.8/site-packages/social_core/utils.py", line 55, in import_module
    __import__(name)
  File "/openedx/edx-platform/import_shims/lms/third_party_auth/__init__.py", line 6, in <module>
    warn_deprecated_import('third_party_auth', 'common.djangoapps.third_party_auth')
  File "/openedx/edx-platform/import_shims/warn.py", line 37, in warn_deprecated_import
    raise DeprecatedEdxPlatformImportError(old_import, new_import)
import_shims.warn.DeprecatedEdxPlatformImportError: Importing third_party_auth instead of common.djangoapps.third_party_auth is deprecated

Using this as the hint, I found out that I was missing the common.djangoapps. for some settings in the production.yml file.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.