Add superuser to Python Django

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.