django 上的管理页面坏了 [英] Admin page on django is broken

查看:25
本文介绍了django 上的管理页面坏了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个带有管理页面的 django 项目.它在开发的前几周完美运行,有一段时间没有使用管理页面,当我回到它时,管理页面坏了.无论我做什么,它都不允许我登录.

I've set up a django project with an admin page. It worked perfectly for the first couple weeks of development, didn't use the admin page for a while, and when I came back to it, the admin page was broken. No matter what I do, it won't allow me to log in.

输入用户名和密码后,管理页面总是显示:

After entering username and PW, the admin page always says:

Please enter a correct username and password. Note that both fields are case-sensitive. 

我检查了数据库:超级用户存在并且 is_active、is_superuser 和 is_staff 都是 True.我已经使用 shell 来确保密码正确.我已经多次刷新、删除和重新创建数据库,以确保没有错误.我还仔细检查了中间件、url、INSTALLED_APPS 等,以确保它们都设置正确.

I've checked the DB: the superuser exists and has is_active, is_superuser, and is_staff all True. I've used the shell to make sure the password is correct. I've flushed, deleted, and re-created the database multiple times to make sure there's no mistake. I've also doublechecked the middleware, urls, INSTALLED_APPS, etc to make sure they're all set up properly.

据我所知,管理页面运行良好,只是它们从不让任何人登录.

As far as I can tell, the admin pages work perfectly except that they never let anyone log in.

有什么想法,或者尝试调试的其他方法吗?这个bug我真的很困惑.

Any ideas what's going on here, or other methods for trying to debug? I'm really baffled by this bug.

PS:如果重要的话,我使用 South 进行 DB 迁移,使用 django-social-auth 进行 FB 登录,并使用单独的 local_settings.py 进行生产和开发(我已经检查了它们 - 冲突不是'那里.)

PS: In case it matters, I'm using South for DB migrations, django-social-auth for FB logins, and separate local_settings.py for production and development (I've checked them both -- the conflict isn't there.)

推荐答案

此问题可能与身份验证后端有关.请检查您的设置文件中的 AUTHENTICATION_BACKENDS 参数.

This problem may be related to the Authentication Backends. Please check your settings files for the AUTHENTICATION_BACKENDS parameter.

试试下面的值:

AUTHENTICATION_BACKENDS = (
    ('django.contrib.auth.backends.ModelBackend'),
)

更多信息官方 Django 文档

这篇关于django 上的管理页面坏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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