Django身份验证适用于Chrome,但不适用于Firefox [英] Django authentication works on Chrome, but not on Firefox

查看:120
本文介绍了Django身份验证适用于Chrome,但不适用于Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个问题,即Django的登录在Chrome上正常工作,但不在Firefox上:尝试在Firefox上登录到该站点的受限制部分时,只需循环回到登录页面;此外,日志上没有出现任何错误信息。
有趣的是,当服务器在本地机器上时,不会发生错误。



有人有一个一般的想法可能导致这种奇怪的行为?



我在Python 2.7中使用Django 1.6

解决方案

这不是一个很大的答案,而是连接到其他类似的问题。因为我没有代表,所有我能做的都是离开答案。



这样的问题在2012年遇到,但从未得出结论性答复:

Django会话在Firefox中不起作用



一个类似的问题,用户可以通过本地服务器登录但不能远程访问firefox:

无法使用有效的用户名和密码登录到django管理页面



第二个记录非常好,有一个很受欢迎的接受答案。



建议:


  1. 如果您没有使用https,请确保您具有此设置SESSION_COOKIE_SECURE = False。

  2. 如果您正在使用数据库备份,检查会话是否实际上在d中创建jango_sessions表。

  3. 如果您使用缓存支持,请检查SESSION_ENGINE是否正确配置了CACHE_BACKEND的django.contrib.sessions.backends.cache 。 / li>


I'm having a problem where Django's login is working okay on Chrome but not on Firefox: when trying to login to a restricted portion of the site on Firefox, it simply loops back again and again to the login page; furthermore, no error message appears on the log regarding that. Interestingly, the error doesn't happen when the server is on the local machine.

Does someone have a general idea of what could be causing that strange behavior?

I'm using Django 1.6 on Python 2.7

解决方案

this isn't much of an answer, but a linking to other similar problems. Because I don't have rep, all I can do is leave an answer.

A issue like this was encountered in 2012 but was never conclusively answered:
Django session doesn't work in Firefox

A similar question where the user could login via local server but not remote firefox was encoutered:
Unable log in to the django admin page with a valid username and password

The second was very well documented and had an accepted answer that was well liked.

Recommendations:

  1. If you are not using https make sure you have this setting SESSION_COOKIE_SECURE = False.
  2. If you are using a database backed, Check if the session is actually being created in the django_sessions table .
  3. If you are using a cached backed, check that SESSION_ENGINE is django.contrib.sessions.backends.cache and that CACHE_BACKEND is properly configured.

这篇关于Django身份验证适用于Chrome,但不适用于Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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