How Django Resets the admin password

Source: Internet
Author: User

If you forget to set the Django Admin password, you can use theCreatesuperuserto even the password, but if you forget the admin password, then you need to use the Django Shell:
Python manage.py Shell

If this time error:

Python:can ' t open file ' manage.py ': [Errno 2] No such file or directory


You set the environment variable, but it is an error, why?

I looked for a long time and finally found the answer here: https://www.pythonanywhere.com/forums/topic/756/, that means, You want the CD to be underneath your project (you should have a manage.py file below your project) and then run: Python manage.py shell

then get your user name and reset the password:

From django.contrib.auth.models Import User user = User.objects.get (username= ' admin ') User.set_password (' New_password ') User.save ()



Then you can log in with the new password.

How Django Resets the admin password

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.