Django身份验证适用于Chrome,但不适用于Firefox [英] Django authentication works on Chrome, but not on Firefox
问题描述
有趣的是,当服务器在本地机器上时,不会发生错误。
有人有一个一般的想法可能导致这种奇怪的行为?
我在Python 2.7中使用Django 1.6
这不是一个很大的答案,而是连接到其他类似的问题。因为我没有代表,所有我能做的都是离开答案。
这样的问题在2012年遇到,但从未得出结论性答复:
Django会话在Firefox中不起作用
一个类似的问题,用户可以通过本地服务器登录但不能远程访问firefox:
无法使用有效的用户名和密码登录到django管理页面
第二个记录非常好,有一个很受欢迎的接受答案。
建议:
- 如果您没有使用https,请确保您具有此设置SESSION_COOKIE_SECURE = False。
- 如果您正在使用数据库备份,检查会话是否实际上在d中创建jango_sessions表。
- 如果您使用缓存支持,请检查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:
- If you are not using https make sure you have this setting SESSION_COOKIE_SECURE = False.
- If you are using a database backed, Check if the session is actually being created in the django_sessions table .
- 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屋!