Django 1.9 createuperuser bypass password verification check

Try working with the new version of django 1.9 and create a superuser:

python manage.py createsuperuser 

And I just want to use a simple password for my local development environment, for example, only one character, updating django1.9 to a very strict password verification policy, how can I get around it?

 Password: Password (again): This password is too short. It must contain at least 8 characters. This password is too common. This password is entirely numeric. 
+12
django passwords
source share
3 answers

You can change the setting of AUTH_PASSWORD_VALIDATORS in your development environment. See Docs: https://docs.djangoproject.com/en/stable/topics/auth/passwords/#s-enabling-password-validation .

It's pretty simple: you will recognize the validators that triggered your warning messages.

+10
source share

After creating a superuser with a complex password, you can install it in a shell (shell. / Manage.py) even easier:

 from django.contrib.auth.models import User user = User.objects.get(username='your_user') user.set_password('simple') user.save() 
+7
source share

In fact, you do not need to change the validator settings or create a complex password first, and then change it. Instead, you can create a simple password, bypassing all password verification tools.

Open the django shell

python manage.py shell

Type of:

from django.contrib.auth.models import User

Press enter and then enter (for example, to use a password consisting only of the letter "a"):

User.objects.create_superuser('someusername', 'something@example.com', 'a')

Press Enter again and you're done.

+3
source share

All Articles