GAE 上的 django nonrel 中的 Django 身份验证
我正在开发中本地运行的谷歌应用程序引擎项目上使用 Django nonrel 项目。我创建了自己的模型,在数据存储中保存和检索这些模型时效果很好。
我希望使用 django.contrib.auth 来提供用户功能。我可以使用 shell 创建用户,并为这些用户分配一个 ID。当我创建自己的引用 User 的模型之一时,我必须传入用户 ID,否则它很可能会失败。
但是,通过 gae 管理界面进行检查,我无法在数据存储中看到我通过 shell 创建的用户的用户模型。我也无法从引用用户的模型之一检索用户详细信息。调用 mymodel.user.username 不会返回任何内容。我也无法使用我设置的用户名和密码登录管理员。我可以在 gae 管理应用程序中查看我制作的模型的保存版本。
我的印象是用户是在数据存储之外的其他地方创建的。我还需要做些什么才能将标准 contrib.auth 用户与 django-nonrel 和 gae 一起使用吗?
I'm using the Django nonrel project on a google app engine project running locally in development. I've created my own models and these are fine when they are saved and retrieved in the datastore.
I'm hoping to use django.contrib.auth to provide the user functionality. I can use the shell to create users and these get assigned an ID. When I create one of my own models which references User I have to pass in a user ID as it quite rightly fails otherwise.
However, checking via the gae admin interface I can't see the User model in the datastore for the users I've created via the shell. Nor can I retreive the user details from one of my models which references them. Calls to mymodel.user.username return nothing. Nor can I log into admin using the username and password I've set up. I can see saved versions of the models I've made in the gae admin app.
I get the impression that users are being created somewhere other than the datastore. Is there something else I need to do to use the standard contrib.auth users with django-nonrel and gae?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了解决方案,并认为我会在这里发帖,以防将来有人遇到这个问题。
我正在使用 Google App Engine 启动器。 Django-nonrel 对标准 Django 进行了更改。启动器使用标准 Django,不包含这些更改。解决方案是使用manage.py runserver,它将看到所有Django非相关更改,包括您自己的模型和Django contrib模型。
I found the solution and thought I'd post back here just in case anyone comes across this question in future.
I was using the Google App Engine launcher. Django-nonrel makes changes to standard Django. The launcher uses standard Django which doesn't contain these changes. The solution is to use the manage.py runserver which will see all the Django non-rel changes including your own models and the Django contrib ones.
只是添加。
我发现,通过在使用高复制数据库的 Google App Engine 应用程序上使用“python manage.py Remote createsuperuser”,更改可能需要一些时间。这意味着您可能需要等待几分钟才能登录。
just adding.
I've found out that by using 'python manage.py remote createsuperuser' on a Google App Engine application that uses High Replication database, the change may take some time. That mean you may have to wait several minute before you can login.