如果我的Django站点设置在子域上,那么SESSION_COOKIE_DOMAIN的正确值是多少? [英] What is the correct value for SESSION_COOKIE_DOMAIN if my Django site is set up on a subdomain?

查看:1142
本文介绍了如果我的Django站点设置在子域上,那么SESSION_COOKIE_DOMAIN的正确值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Django网站上设置了一个子域上的Cookie的问题。它工作了几天,然后消息'您的浏览器不接受cookies'出现在登录页面。我需要重新启动我的网络服务器,使其工作几天,这个周期重复。<​​/ p>

这真的很令人沮丧。我不知道我做错了什么。我怀疑SESSION_COOKIE_DOMAIN可能设置为错误的值。正确的设置方法是什么?


  1. SESSION_COOKIE_DOMAIN =
    'subdomain.domain.com'

  2. SESSION_COOKIE_DOMAIN =
    '.domain.com'

  3. SESSION_COOKIE_DOMAIN =
    ''

  4. / li>

任何帮助。它对我来说非常奇怪(我的意思是一切工作后,Web服务器重新启动...)。

解决方案

看起来像:

  SESSION_COOKIE_DOMAIN ='domain.com'



希望这有助于某人。


I have constant problem with cookies on my Django site which is set up on a subdomain. It works for a couple of days, then message 'your browser doesn't accept cookies' appears on a login page. I need to restart my web server to make it work for a couple of next days and this cycle repeats.

This is really frustrating. I am not sure what am I doing wrong. I suspect that SESSION_COOKIE_DOMAIN might be set to a wrong value. What is the proper way to set it?

  1. SESSION_COOKIE_DOMAIN = 'subdomain.domain.com'
  2. SESSION_COOKIE_DOMAIN = '.domain.com'
  3. SESSION_COOKIE_DOMAIN = ''
  4. other?

Any help is appreciated. It behaves very strange for me (I mean that everything works after web server is restarted...). Maybe the problem lies in configuration of web server?

解决方案

Looks like:

SESSION_COOKIE_DOMAIN = 'domain.com'

solved the problem.

Hope this helps someone.

这篇关于如果我的Django站点设置在子域上,那么SESSION_COOKIE_DOMAIN的正确值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆