I have to redirect to home page without login in subdomain after login in public tenant That means suppose -
public domain is : logic.com
subdomain is : tenant1.logic.com I have tried to login to the public domain (logic.com/login) so now I have to redirect to the home page of the subdomain(tenant1.logic.com/home) Without subdomain login
def login_user(request):
if request.method == 'GET':
return render(request, 'users/login-user.html', {'form': AuthenticationForm()})
else:
user = authenticate(request, username=request.POST['email'], password=request.POST['password'])
if user is None:
return render(request, 'users/login-user.html', {'form': AuthenticationForm(), 'error': 'Username and '
'password did not '
'match'})
else:
client = Client.objects.filter(owner=user).first()
with schema_context(client.schema_name):
login(request, client.owner)
host = request.META.get('HTTP_HOST', '')
scheme_url = request.is_secure() and "https" or "http"
url = f"{scheme_url}://{client.slug}.{host}"
return HttpResponseRedirect(url)
What can I do if anyone has know about this?
Thanks in advance
Also I have added install app from setting

I am getting this error : django.contrib.sessions.exceptions.SessionInterrupted: The request's session was deleted before the request completed. The user may have logged out in a concurrent request, for example.