From Django. contrib. Auth. Models import user
User = user. Objects. create_superuser ('name', 'emailname @ demon.com ', 'Password ')
The first is the user name, the second is the mailbox, and the third is the password.
This method may cause errors,Add the django_settings_module variable to the system environment variable and set its value to mysite. settings (mysite is the project name in the working directory)
Add pythonpath: D :\\ python27; F: \ workforce \ Python (F: \ workforce \ python is the working directory of the python project.) Run it again. Maybe there is still an error. I used Django + MySQL. I didn't understand Why or why it was wrong, but the user successfully created it, so I am too lazy to care about it. In addition:
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.