11👍
You can change the AUTH_PASSWORD_VALIDATORS setting in in your dev environment. See the docs: https://docs.djangoproject.com/en/stable/topics/auth/passwords/#s-enabling-password-validation.
It is pretty straightforward: you will recognize the validators that caused your warning messages.
13👍
After creating the superuser with a complex password, you can set it to something easier in the shell (./manage.py shell):
from django.contrib.auth.models import User
user = User.objects.get(username='your_user')
user.set_password('simple')
user.save()
- Getting a "The following content types are stale and need to be deleted" when trying to do a migrate. What does this mean, and how can I solve it?
- Iterate over choices in CheckboxSelectMultiple
- Google oAuth 2.0 API Authentication Error: Error 400 – redirect_uri_mismatch (does not comply with policy) DJANGO APP
4👍
In fact, you do not need to modify the validator settings or first create a complex password and then later change it. Instead you can create a simple password directly bypassing all password validators.
Open the django shell
python manage.py shell
Type:
from django.contrib.auth.models import User
Hit enter and then type (e.g. to use a password consisting only of the letter ‘a’):
User.objects.create_superuser('someusername', 'something@example.com', 'a')
Hit enter again and you’re done.
- Iterate over choices in CheckboxSelectMultiple
- How would I use django.forms to prepopulate a choice field with rows from a model?
- How do I generate models for an existing database in Django?
- How to properly runserver on different settings for Django?
- How to make static files works using django docker nginx and postgresql since its not serving them
0👍
mimo‘s answer is correct but don’t works if you don’t using default User
model
According mimo‘s answer and this article, I changed script to this one
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.get(email='user@mail.com')
# or user = User.objects.get(username='your_user')
user.set_password('simple')
user.save()
- How to output text from database with line breaks in a django template?
- How to create multiple workers in Python-RQ?
- How to log requests and responses in Django?