在 django-nonrel 中创建超级用户
我是一个新手,一直在学习 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
解决了这个问题。对于遇到同样问题的其他人,为了让管理员工作:
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.
对于那些仍然无法创建超级用户的人,您可以从 appengine 管理 Web 界面尝试。当您启动应用程序时,您可以看到类似的日志:
管理控制台的最后一行是管理界面的 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:
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.
在幕后,Django 维护着一个“身份验证后端”,它检查身份验证。因此,您可能会遇到一些其他问题。所以除了@iali 的回答之外。你需要确保你。
settings.MIDDLEWARE_CLASSES
不包含任何其他身份验证中间件。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.
settings.MIDDLEWARE_CLASSES
does not include any additional authentication middleware.settings.AUTHENTICATION_BACKENDS
is not set.