Lms not working after trying to log in or register

I have applied a custom theme to the lms since then I am not able to log in and sign up for a new user, I am getting an internal error on lms

Open Edx version: koa
OS: Ubuntu 20.04
I checked the lms log and found the following error message

Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/utils/deprecation.py", line 94, in __call__
    response = response or self.get_response(request)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 36, in inner
    response = response_for_exception(request, exc)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 129, in handle_uncaught_exception
    return callback(request, **param_dict)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 95, in wrapper
    return func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/static_template_view/views.py", line 103, in render_500
    return HttpResponseServerError(render_to_string('static_templates/server-error.html', {}, request=request))
  File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 183, in render_to_string
    return template.render(dictionary, request)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/template.py", line 83, in render
    return self.mako_template.render_unicode(**context_dictionary)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/template.py", line 481, in render_unicode
    return runtime._render(
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/runtime.py", line 878, in _render
    _render_context(
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "/tmp/mako_lms/57c26317c7ef105628d6e8654b1d4494/bdu-portal/lms/templates/main.html.py", line 339, in render_body
    runtime._include_file(context, (static.get_template_path('header.html')), _template_uri, online_help_token=online_help_token)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
    callable_(ctx, **kwargs)
  File "/tmp/mako_lms/57c26317c7ef105628d6e8654b1d4494/bdu-portal/lms/templates/header.html.py", line 34, in render_body
    runtime._include_file(context, (static.get_template_path(relative_path='header/header.html')), _template_uri, online_help_token=online_help_token)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
    callable_(ctx, **kwargs)
  File "/tmp/mako_lms/57c26317c7ef105628d6e8654b1d4494/bdu-portal/lms/templates/header/header.html.py", line 110, in render_body
    runtime._include_file(context, 'navbar-authenticated.html', _template_uri, online_help_token=online_help_token)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/mako/runtime.py", line 795, in _include_file
    callable_(ctx, **kwargs)
  File "/tmp/mako_lms/57c26317c7ef105628d6e8654b1d4494/bdu-portal/lms/templates/header/navbar-authenticated.html.py", line 123, in render_body
    if should_display_shopping_cart_func() and not (course and static.is_request_in_themed_site()): # see shoppingcart.context_processor.user_has_cart_context_processor
TypeError: 'Undefined' object is not callable

Hi there! have you tried to update your theme according to the release you’re on? You can compare the templates in your theme with the ones in the platform and adjust them

1 Like

@mahesh1b yea it looks like your navbar-authenticated.html.py file is trying to call a function that it can’t find. Thus, the error.
While it would be helpful to know what theme you are installing and–as Maria mentioned–make sure that it is compatible with your EdX version, you can also just delete the offending lines in your navbar-authenticated file and see where that gets you.
It looks like you might just lose some shopping cart functionality (make sure you don’t need that functionality) and it might work. You might also end up in a rabbit hole of finding and trying to squash new errors. In which case you’ve likely got a larger compatibility issue.
But overall, the logs do a pretty good job of pinpointing where the template file is erroring. Easiest thing is to delete erroring lines until you get to a working theme, then see if you need to bring back any of those lines that you took out.

1 Like

I have been able to resolve the login issue for the LMS:

  • Reverted the custom theme files and folders to the koa version custom theme from juniper.
  • Removed the shoppingcart folder from the custom theme as the shoppingcart component is removed from the koa version and this was giving the error.
  • Removed the shoppingcart function references from HTML files:
    1. /home/ubuntu/theme/templates/navigation/navbar-authenticated.html
      We are using a custom theme for the LMS
      However now whenever I log in to the LMS I am not able to see courses in the Dashboard

      Getting confliction in the dashboard file from the koa version of /dashboard.html file and custom theme’s /dashboard.html file (juniper version).
1 Like