Skip to content

Commit 0ae9770

Browse files
author
Nick Spacek
committed
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.
1 parent d25df33 commit 0ae9770

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rest_auth/registration/serializers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
# Import is needed only if we are using social login, in which
55
# case the allauth.socialaccount will be declared
66
try:
7+
apps.get_app_config('allauth.socialaccount')
78
from allauth.socialaccount.helpers import complete_social_login
9+
except LookupError:
10+
pass
811
except ImportError:
912
pass
1013

0 commit comments

Comments
 (0)