标签:
from django.contrib.auth.models import User
user=User.objects.create_superuser(‘name‘,‘emailname@demon.com‘,‘password‘)
第一个为用户名,第二个是邮箱,第三是密码
用这个方法可能会出错,系统环境变量中添加DJANGO_SETTINGS_MODULE变量,将其值设置为mysite.settings(mysite为工作目录中的project名称)
官方:http://docs.djangoproject.com/en/dev/topics/auth/#topics-auth-creating-superusers
manage.py createsuperuser --username=joe --email=joe@example.com
You will be prompted for a password. After you enter one, the user will be
created immediately.
标签:
原文地址:http://www.cnblogs.com/aguncn/p/4816829.html