Django 会话在 10 秒内超时
我终于部署了该应用程序。生产和会话超时非常快。
如果我不连续点击链接,链接就会在 15-20 秒后过期。
这不会发生在 Dev 中。但设置又完全不同。
这是我在生产中的设置 - nginx + apache (wsgi) + django 1.1.2
后端是mysql。
nginx 中的 keepalive 是“keepalive_timeout 15;”,但文档说它是针对 nginx 启动的进程的,但与此无关。
以下内容位于 settings.py 中 -
`TEMPLATE_CONTEXT_PROCESSORS = (`
`'django.core.context_processors.auth',`
`'django.core.context_processors.debug',`
`'django.core.context_processors.i18n',`
`'django.core.context_processors.media',`
`'django.core.context_processors.request',`
`'myown.custom_settings_context_processor.myown_custom_settings',`
`)`
`SESSION_ENGINE = (`
`'django.contrib.sessions.backends.cache'`
`)`
`INSTALLED_APPS = (`
`'django.contrib.auth',`
`'django.contrib.contenttypes',`
`'django.contrib.sessions',`
`'django.contrib.sites',`
`'django.contrib.admin',`
`)`
如果有更多信息。是必需的,请告诉我,我会放上。 任何关于为什么会发生这种情况的指示,表示赞赏。
I've finally deployed the app. on production and the session timesout very quickly.
If I'm not continuously clicking on links, it'll expire in 15-20 seconds.
This doesn't happen in Dev. but again the setup is completely different.
Here is the setup I have in production -
nginx + apache (wsgi) + django 1.1.2
Backend is mysql.
The keepalive in nginx is "keepalive_timeout 15;" but the documentation says its for the process nginx launches and isn't related.
Following is present in the settings.py -
`TEMPLATE_CONTEXT_PROCESSORS = (`
`'django.core.context_processors.auth',`
`'django.core.context_processors.debug',`
`'django.core.context_processors.i18n',`
`'django.core.context_processors.media',`
`'django.core.context_processors.request',`
`'myown.custom_settings_context_processor.myown_custom_settings',`
`)`
`SESSION_ENGINE = (`
`'django.contrib.sessions.backends.cache'`
`)`
`INSTALLED_APPS = (`
`'django.contrib.auth',`
`'django.contrib.contenttypes',`
`'django.contrib.sessions',`
`'django.contrib.sites',`
`'django.contrib.admin',`
`)`
If any more info. is required, please let me know and I'll put it.
Any pointers about why this would be happening, appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢 django 团队的 Anil。
看来我没有正确配置缓存。
通过在我的 settings.py 中注释这些行来进入默认缓存,一切都像魅力一样工作!
SESSION_ENGINE = (
'django.contrib.sessions.backends.cache'
)
谢谢 Anil &布赖恩·HV
Thanks to Anil from the django team.
Seems I haven't configured by caching properly.
Went to the default caching by commenting these lines in my settings.py and everything worked like a charm !!!!
SESSION_ENGINE = (
'django.contrib.sessions.backends.cache'
)
Thanks Anil & BrianHV