S
S
softshape2015-02-14 17:06:38
Django
softshape, 2015-02-14 17:06:38

How to return two session cookies at once in Django?

Hello everyone,
as you know, by default in Django SESSION_COOKIE_DOMAIN = "domain.com". And if we want sessions to be rummaged between subdomains, then we add a dot: SESSION_COOKIE_DOMAIN = ".domain.com"
The problem is that if the site was launched with the first option, and in the process it decided to change to the second, all users will lose their sessions.
As far as I understand, this problem can be solved by returning two session cookies at once -
Domain=.domain.com; Path=/
Domain=domain.com; Path=/
The question is, what is the best way to do this in Django?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey K, 2015-02-14
@mututunus

Write your SessionMiddleware.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question