在 django-nonrel 中创建超级用户

发布于 2024-09-11 23:27:22 字数 492 浏览 8 评论 0原文

我是一个新手,一直在学习 django-nonrel 教程,并在 Google App Engine 中设置了 django-nonrel 。

我现在尝试使用以下命令创建超级用户:

manage.py createsuperuser --username=joe [email  ;protected]

我收到

Unknown command: 'createsuperuser'
输入“manage.py help”以了解用法

当我输入manage.py help时,我没有看到列出的createsuperuser。

帮助。

I'm a newbie been going through the django-nonrel tutorials and have set up django-nonrel inside of Google App Engine.

I am now trying to create a superuser using:

manage.py createsuperuser --username=joe [email protected]

I get

Unknown command: 'createsuperuser'
Type 'manage.py help' for usage

When I type manage.py help, I don't see createsuperuser listed.

Help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

远山浅 2024-09-18 23:27:22

解决了这个问题。对于遇到同样问题的其他人,为了让管理员工作:

1) 确保 django.contrib.auth 位于 settings.py 中的installed_apps 部分

2) 停止 runserver,然后使用 创建超级用户>manage.py createsuperuser
创建超级用户后,再次启动 runserver。

Solved this. For anyone else having the same problem, in order to get admin to work:

1) Ensure that django.contrib.auth is installed_apps section in your settings.py

2) Stop runserver, then createsuperuser using manage.py createsuperuser.
AFTER you've created the superuser, start runserver again.

爱已欠费 2024-09-18 23:27:22

对于那些仍然无法创建超级用户的人,您可以从 appengine 管理 Web 界面尝试。当您启动应用程序时,您可以看到类似的日志:

prost@prost-VirtualBox:~/projects/website$ ./manage.py runserver
WARNING:root:The rdbms API is not available because the MySQLdb library could not be loaded.
INFO:google.appengine.tools.appengine_rpc:Server: appengine.google.com
INFO:root:Checking for updates to the SDK.
INFO:root:Running application dev~incloudscz on port 8000: http://127.0.0.1:8000
INFO:root:Admin console is available at: http://127.0.0.1:8000/_ah/admin
...
...

管理控制台的最后一行是管理界面的 URL。您可以通过“数据存储查看器”-> 创建/查看用户“实体种类:auth_user”->将 is_superuser 设置为 True 的“列出实体”或“创建实体”。

For those who are still not able to create superuser, you can try it from appengine admin web interface. When you start your application you can see similar log:

prost@prost-VirtualBox:~/projects/website$ ./manage.py runserver
WARNING:root:The rdbms API is not available because the MySQLdb library could not be loaded.
INFO:google.appengine.tools.appengine_rpc:Server: appengine.google.com
INFO:root:Checking for updates to the SDK.
INFO:root:Running application dev~incloudscz on port 8000: http://127.0.0.1:8000
INFO:root:Admin console is available at: http://127.0.0.1:8000/_ah/admin
...
...

The last line with admin console is URL of an admin interface. You can create/view user there via "Datastore viewer" -> "Entity kind: auth_user" -> "List entities" or "Create entity" with is_superuser set to True.

沉溺在你眼里的海 2024-09-18 23:27:22

在幕后,Django 维护着一个“身份验证后端”,它检查身份验证。因此,您可能会遇到一些其他问题。所以除了@iali 的回答之外。你需要确保你。

  1. 确保您的 settings.MIDDLEWARE_CLASSES 不包含任何其他身份验证中间件。
  2. 确保您的 settings.AUTHENTICATION_BACKENDS 未设置。

Behind the scenes, Django maintains a list of “authentication backends” that it checks for authentication. As a result of this there could be a few additional problems you can run into. So in addition to @iali's answer. You need to make sure that you.

  1. make sure that your settings.MIDDLEWARE_CLASSES does not include any additional authentication middleware.
  2. make sure that your settings.AUTHENTICATION_BACKENDS is not set.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文