diff --git a/django_project/middleware.py b/django_project/middleware.py index ac60a3c..ac93aa2 100644 --- a/django_project/middleware.py +++ b/django_project/middleware.py @@ -11,7 +11,7 @@ class AutoLoginMiddleware: def __call__(self, request): # Only perform auto-login if in DEBUG mode and user is not authenticated. - if settings.DEBUG and not request.user.is_authenticated: + if settings.DEBUG and not request.user.is_authenticated and request.host in ['pocket-trade.fly.dev', 'localhost', '127.0.0.1']: user = CustomUser.objects.get(email='rob@badblocks.email') login(request, user, backend='django.contrib.auth.backends.ModelBackend')