ImportError: No module named 'debug_toolbar'

Hi there,
tutor k8s lms container gives same error. But tutor local working properly… Any ideas ?
Thanks,
Murat

(tutor) muro@mppc:~$ tutor k8s exec lms bash
kubectl exec -i -t --namespace openedx lms-5894c8bc5b-l9f9m -- sh -e -c bash
root@lms-5894c8bc5b-l9f9m:/openedx/edx-platform# ./manage.py lms create_catalog_integrations --enabled \
>     --internal_api_url=http://discovery:8000/api/v1 \
>     --service_username=lms_catalog_service_user
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.5/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.5/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/openedx/venv/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/opt/pyenv/versions/3.5.9/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
ImportError: No module named 'debug_toolbar'

Anyone figured out how to fix this error? I’m using the latest tutor image overhangio/openedx:10.4.1 and I am getting same error.

When you exec into a container, you need to properly set the environment variables that are usually set by the entrypoint. You go through the entrypoint when you run a container, but not when you exec into it.

tl;dr: you should properly define the DJANGO_SETTINGS_MODULE environment variable.

Is there any document that outlines what are settings we need to before running manage.py?

Also I see docker-entrypoint.sh as entrypoint whereas in the container I don’t see that file at all.

Ok. I found how to set it

DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS

Thanks now it is working.

No there isn’t. If you exec into a running container we assume that you are a big boy and you know what you are doing :slight_smile:

1 Like