开发者

Django logging in and out - doesn't work if prepend_www set

开发者 https://www.devze.com 2023-01-03 23:22 出处:网络
I\'m a Django beginner. My site - let\'s call it abc.com - works fine, letting users log in and out (having originally registered via Django registratiaon). If it\'s relevant, my virtuahosts file has

I'm a Django beginner.

My site - let's call it abc.com - works fine, letting users log in and out (having originally registered via Django registratiaon). If it's relevant, my virtuahosts file has ServerName abc.com and ServerAlias www.abc.com directives.

I don't want my visitors to sense that both abc.com and www.abc.com exist, and so discovered Django's prepen开发者_运维技巧d_www setting, which works as intended. In addition to working as intended, however, there's a side effect that disables logging in and out when visiting the www. variant of my site.


In your settings.py try setting:

SESSION_COOKIE_DOMAIN = ".abc.com"

This will make the cookie apply to all the subdomains of abc.com.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号