Accessing /admin throws Site matching query does not exist

484 views
Skip to first unread message

Juanito

unread,
Apr 6, 2016, 3:59:39 PM4/6/16
to Open edX operations
Hi,

I try to access django admin but when I do it gives me "there has been a 500 error..."
I have LMS, CMS running on one server, and mysql on another server.  

/edx/var/log/lms/edx.log
outputs: DoesNotExist: Site matching query does not exist.

Apr  6 19:43:46 ip-172-16-1-10 [service_variant=lms][django.request][env:sandbox] ERROR [ip-172-16-1-10  31979] [base.py:256] - Internal Server Error: /admin/login/
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/ratelimitbackend/admin.py", line 30, in login
    return login(request, **defaults)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/ratelimitbackend/views.py", line 65, in login
    current_site = get_current_site(request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/sites/shortcuts.py", line 15, in get_current_site
    return Site.objects.get_current(request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/sites/models.py", line 62, in get_current
    return self._get_site_by_request(request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/sites/models.py", line 46, in _get_site_by_request
    site = self.get(domain__iexact=host)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
    self.model._meta.object_name
DoesNotExist: Site matching query does not exist.


I check select * from django_site and I see an entry there domain = example.com, name = example.com

Anyone have experienced this?

Thanks

Braden MacDonald

unread,
Apr 6, 2016, 6:08:59 PM4/6/16
to opene...@googlegroups.com
I have been experiencing this on devstack lately, and have found that it only happens if I am not logged in. If I login to the LMS first, then access the django admin, it works fine.

--
Braden

--
You received this message because you are subscribed to the Google Groups "Open edX operations" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openedx-ops...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openedx-ops/5c4488d9-92aa-4418-a023-1ea0d2f5096e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Juanito

unread,
Apr 6, 2016, 8:33:45 PM4/6/16
to Open edX operations
Wow, that is the strangest thing, it happens on sandbox too. I should find out why this happen

Thanks Branden.
Reply all
Reply to author
Forward
0 new messages