Tuesday, February 25, 2014

edX-platform - Error in dashboard when logging in as superuser account

In edX-platform, you can access the Django's interface by accessing this following url:

http://your.url.com/admin

And logging in using the superuser account. But, after you logged in, you access the home page, you will see this error:


You can see the stack trace at /edx/var/log/supervisor/lmstderr.log

2014-02-25 01:14:51,112 ERROR 5367 [django.request] base.py:215 - Internal Server Error: /dashboard
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 20, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/student/views.py", line 511, in dashboard
    return render_to_response('dashboard.html', context)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 117, in render_to_response
    return HttpResponse(render_to_string(template_name, dictionary, context_instance, namespace), **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 104, in render_to_string
    return template.render_unicode(**context_dictionary)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/template.py", line 452, in render_unicode
    as_unicode=True)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 807, in _render
    **_kwargs_for_callable(callable_, data))
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 839, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 865, in _exec_template
    callable_(context, *args, **kwargs)
  File "/tmp/tmpjR6VSFmako/main.html.py", line 253, in render_body
    __M_writer(filters.decode.utf8(self.body()))
  File "/tmp/tmpjR6VSFmako/dashboard.html.py", line 131, in render_body
    __M_writer(filters.html_escape(filters.decode.utf8( user.profile.name )))
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 255, in __get__
    rel_obj = self.get_query_set(instance=instance).get(**params)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get
    % self.model._meta.object_name)
DoesNotExist: UserProfile matching query does not exist.


It is because the superuser account you used does not have a profile. So, just log out and setup a normal student account, everything will be OK.