https://docs.djangoproject.com/en/3.2/ref/django-admin/#createsuperuser
The `changepassword` admin command is used in a very similar way. It would
be helpful if this command also provided a `--no-input` variant that would
read from the `DJANGO_SUPERUSER_PASSWORD` environment variable and change
a users password without interactively prompting for input.
https://docs.djangoproject.com/en/3.2/ref/django-admin/#changepassword
--
Ticket URL: <https://code.djangoproject.com/ticket/33296>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
Comment:
Thanks for this ticket, however I'm skeptical. We've already had doubts
about using `DJANGO_SUPERUSER_PASSWORD` in the `createsuperuser`, see
#27801. In the end we accepted #27801 because creating a new superuser can
be complicated which is not the case in changing a password. You can
create a custom command in your project or use a small standalone script:
{{{
UserModel = get_user_model()
user =
UserModel._default_manager.db_manager('default').get(username=username)
user.set_password(new_password)
}}}
Please first start a discussion on the DevelopersMailingList, where you'll
reach a wider audience and see what other think, and
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features follow the guidelines with regards to
requesting features].
--
Ticket URL: <https://code.djangoproject.com/ticket/33296#comment:1>
Comment (by johnthagen):
Thank you for the script example. For those that use this as a reference,
you will also need to add the following line to the end of the script from
Mariusz Felisiak:
{{{
user.save()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33296#comment:2>