diff --git a/zerver/signals.py b/zerver/signals.py index 88b3cf30d9..f46e1dd82b 100644 --- a/zerver/signals.py +++ b/zerver/signals.py @@ -8,10 +8,6 @@ from django.template import loader from django.utils import timezone from typing import Any, Dict, Optional -from zerver.context_processors import common_context -from zerver.models import UserProfile - - def get_device_browser(user_agent): # type: (str) -> Optional[str] user_agent = user_agent.lower() @@ -54,6 +50,11 @@ def get_device_os(user_agent): def email_on_new_login(sender, user, request, **kwargs): # type: (Any, UserProfile, Any, Any) -> None + # We import here to minimize the dependencies of this module, + # since it runs as part of `manage.py` initialization + from zerver.context_processors import common_context + from zerver.models import UserProfile + if not settings.SEND_LOGIN_EMAILS: return