Django-nonrel无法以超级用户身份登录

Django-nonrel无法以超级用户身份登录

问题描述:

我已经做了这样的命令

python manage.py createsuperuser

如果我python manage.py runserver

在这种情况下,我可以登录,并且可以看到我创建的用户.

In this case I can login, and I can see the user I created.

如果我使用GAE的SDK启动服务器,则无法登录.为什么?

While if I use GAE's SDK to start the server, I canNOT log in. Why?

这可能是问题所在

您已经为正常的django项目设置了数据库.
因此manage.py createsuperuser将在该数据库中创建一个超级用户.

You have setup a database for a normal django project.
So manage.py createsuperuser will create a superuser in that database.

对于GAE SKD,它使用GAE Datastore,因此您创建的超级用户不存在.

In case of GAE SKD, it uses the GAE Datastore, so the superuser you created is not present there.

这是您可以做的:

  • 创建普通用户
  • 转到/_ah/admin/并修改数据存储区中用户表的数据,将所需的用户is_superuser字段更改为True.
  • Create a normal user
  • Go to /_ah/admin/ and modify the data for user table in datastore, changing the desired users is_superuser field to True.