diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 5ca5da20e..1ef3e1751 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -81,8 +81,9 @@ except ImportError: # Fixes (#1712). We keep the try/except for the test suite. guardian = None try: - import guardian - import guardian.shortcuts # Fixes #1624 + if 'guardian' in settings.INSTALLED_APPS: + import guardian + import guardian.shortcuts # Fixes #1624 except ImportError: pass