Reputation: 1861
I have 2 Django projects :
project_redirect
, which is running on http://localhost.com:8005project_logged_in
, which is running on http://localhost.com:8000 (I'm authenticated in this one) When I try to do a redirect from project_redirect
to a view that requires authentication in my project_logged_in
, I get unlogged in project_logged_in
(checked that with request.user.is_authenticated()
in the first line of the view).
my redirect view is as sample as :
def test_redirect_view(request):
return HttpResponseRedirect('http://localhost.com:8000/login_required_view/')
Why would this happen?
Upvotes: 0
Views: 90
Reputation: 32294
Your session cookie is being shared by both projects as they are using the same domain.
Try setting SESSION_COOKIE_NAME
in both projects to something unique.
Upvotes: 1