使用
python manage.py createsuperuser
创建超级用户时只能默认输入:用户名,邮箱,及密码来创建有的时候我们需要创建的时候指定额外的字段,可以通过下面的方法
使用
python manage.py shell
进入shell脚本在shell脚本中
from users.models import User
User.objects.create_superuser('用户名','邮箱','密码',mobile=19111111111)
# User.objects.create_superuser()
# 前三个字段是固定的,可以通过关键字参数来指定需要添加的额外参数