2013-10-10 53 views

回答

12

這對我很有用。

我創建了一個新的中間件

from social.apps.django_app.middleware import SocialAuthExceptionMiddleware 
from django.http import HttpResponse 
from social import exceptions as social_exceptions  

class MySocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware): 
    def process_exception(self, request, exception): 
     if hasattr(social_exceptions, exception.__class__.__name__): 
      return HttpResponse("catched: %s" % exception) 
     else: 
      raise exception 

,並把它添加到settings.py中

MIDDLEWARE_CLASSES = (
    ... 
    'path.to.MySocialAuthExceptionMiddleware', 
    ) 
+0

如果想在某個地方的問題,但它會提高這裏.. –

相關問題