无法登录到Django / admin界面 [英] Can't login to Django /admin interface

查看:153
本文介绍了无法登录到Django / admin界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我是新手。我正在运行 Ubuntu 11.04 ,它附带了 Python 2.7,所以我在不同的目录中安装了Python2.5 ,以在Google App Engine上运行 Django-Non-Rel
我做了留言本教程,现在我试图添加管理员访问,但是当我输入正确的用户名:密码Django认为它的错误。



我补充说:

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


INSTALLED_APPS =(
...
'django.contrib.admin',
....

/ pre>

编辑

我还添加了


url(r'^ admin /',include(admin.site.urls)),


到子项目目录中的urls.py。

EOEDIT



然后我创建了超级用户和同步的数据库:

 code>> python2.5 xxx-xxx-guestbook / manage.py createduperuser python2.5 
> xxx-xxx-guestbook / manage.py syncdb

然后运行应用程序,无法登录。我创建了多个不同的超级用户,总是有相同的结果。



EDIT2



感谢大家试图帮助,但不幸的是所提供的解决方案都不能解决问题。我决定自己先学习Django,然后再转到GAE Django-nonrel,所以这个问题不再相关了。我还应该选择一个答案给某人一些点?

解决方案

不太确定,但syncdb可能会删除超级用户刚刚创建。尝试在syncdb提示您时创建超级用户。



否则,请查看用户模型 ./ manage.py shell 中。检查 User.objects.all()[0] .is_superuser


First of all, I am a newbie. I'm running Ubuntu 11.04 which comes with Python 2.7 so I installed Python2.5 in different dir to run Django-Non-Rel on Google App Engine. I did the Guestbook tutorial and now I am trying to add admin access but when I type in correct username:password Django thinks its incorrect. It doesn't even work when deployed to GAE. If you know please poke me in the right direction.

I added:

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

INSTALLED_APPS = (
    ...
    'django.contrib.admin',
    ....
)

EDIT
I also added

url(r'^admin/', include(admin.site.urls)),

to urls.py in subproject directory.
EOEDIT

Then I created superuser and synced databases:

> python2.5 xxx-xxx-guestbook/manage.py createsuperuser python2.5
> xxx-xxx-guestbook/manage.py syncdb

Then ran the app and can't login. I created multiple different supersusers always with the same result.

EDIT2

Thanks everyone for trying to help but unfortunately neither of the offered solutions fixed the problem. I have decided to first learn Django on its own and then maybe switch to GAE Django-nonrel, so the question is not relevant anymore. Should I still pick one answer to give someone some points?

解决方案

Not too sure on this, but syncdb might remove the superuser you just created. Try creating a superuser when syncdb prompts you to.

Otherwise, take a look at the user model in ./manage.py shell. Check User.objects.all()[0].is_superuser.

这篇关于无法登录到Django / admin界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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