- 创建管理员账号:
1python manage.py createsuperuser - 也可以手动添加:
python manage.py shell123456from django.contrib.auth.models import Useruser=User()user.username="admin"user.is_superuser=Trueuser.set_password('admin')user.save()
DevOps
1 |
python manage.py createsuperuser |
python manage.py shell
|
1 2 3 4 5 6 |
from django.contrib.auth.models import User user=User() user.username="admin" user.is_superuser=True user.set_password('admin') user.save() |