diff --git a/shared_session/templatetags/shared_session.py b/shared_session/templatetags/shared_session.py index cd574aa..ed4a31f 100644 --- a/shared_session/templatetags/shared_session.py +++ b/shared_session/templatetags/shared_session.py @@ -66,6 +66,10 @@ def render(self, context): if request.session.is_empty(): return '' + # Sometimes host is not in meta, ex. in tests. + if 'HTTP_HOST' not in request.META: + return '' + try: self.ensure_session_key(request)