Я столкнулся с той же проблемой, и кажется, что создание представления обертки - лучший способ справиться с этой ситуацией, на данный момент, по крайней мере. Вот как я это сделал:
def social_auth_login(request, backend):
"""
This view is a wrapper to social_auths auth
It is required, because social_auth just throws ValueError and gets user to 500 error
after every unexpected action. This view handles exceptions in human friendly way.
See https://convore.com/django-social-auth/best-way-to-handle-exceptions/
"""
from social_auth.views import auth
try:
# if everything is ok, then original view gets returned, no problem
return auth(request, backend)
except ValueError, error:
# in case of errors, let's show a special page that will explain what happened
return render_to_response('users/login_error.html',
locals(),
context_instance=RequestContext(request))
Для этого вам нужно настроить url
:
urlpatterns = patterns('',
# ...
url(r'^social_auth_login/([a-z]+)$', social_auth_login, name='users-social-auth-login'),
)
А затем используйте его как в шаблоне:
<a href="{% url 'users-social-auth-login' "google" %}">Log in with Google</a>
Надеюсь, это поможет, даже спустя два месяца после того, как был задан вопрос:)