From 0ae97701c8934db1860b19e6b34b01e2f59f6d3f Mon Sep 17 00:00:00 2001 From: Nick Spacek Date: Thu, 1 Oct 2015 09:51:25 -0300 Subject: [PATCH] Adds check for optional deps in INSTALLED_APPS Previously the serializers.py file relied solely on the presence of allauth.socialaccount in the PYTHON_PATH to determine if its use was required. This adds another check in the Django INSTALLED_APPS for the allauth.socialaccount app, and then continues with the import if the app has been added. --- rest_auth/registration/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 48d2963..389c535 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -4,7 +4,10 @@ from requests.exceptions import HTTPError # Import is needed only if we are using social login, in which # case the allauth.socialaccount will be declared try: + apps.get_app_config('allauth.socialaccount') from allauth.socialaccount.helpers import complete_social_login +except LookupError: + pass except ImportError: pass