如何通过Django灯具添加SUPERuser(不仅仅是用户)?
假设我想登录:admin,密码:admin.
在空数据库上:
python manage.py createsuperuser python manage.py dumpdata auth.User --indent 4 > users.json
在users.json
你需要固定装置.
./manage.py shell >>> from django.contrib.auth.hashers import make_password >>> make_password('test') 'pbkdf2_sha256$10000$vkRy7QauoLLj$ry+3xm3YX+YrSXbri8s3EcXDIrx5ceM+xQjtpLdw2oE='
并创建fixtures文件:
[ { "model": "auth.user", "pk": 1, "fields": { "username": "admin", "password": "pbkdf2_sha256$10000$vkRy7QauoLLj$ry+3xm3YX+YrSXbri8s3EcXDIrx5ceM+xQjtpLdw2oE=" "is_superuser": true, "is_staff": true, "is_active": true } } ]