admin用户非交互式创建:
echo "from django.contrib.auth.models import User; User.objects.create_superuser(‘myadmin‘, ‘[email protected]‘, ‘hunter2‘)" | python manage.py shell
依赖auth.user的数据库迁移:
python manage.py migrate auth python manage.py migrate
参考资料:
http://stackoverflow.com/questions/1466827/automatically-create-an-admin-user-when-running-djangos-manage-py-syncdb
http://stackoverflow.com/questions/29689365/auth-user-error-with-django-1-8-and-syncdb-migrate
时间: 2024-11-09 01:40:51