I tried to change my admin password but I have an error while running user = User.objects.get(username='normaluser')
Asked
Active
Viewed 1,342 times
0

Rami
- 21
- 9
-
You'll have to import the user model from `core` app – Brian Destura Apr 12 '22 at 02:08
-
@BrianDestura If I use `from django.contrib.core.models import User` it show this error **Traceback (most recent call last): File "
", line 1, in – Rami Apr 12 '22 at 02:14ModuleNotFoundError: No module named 'django.contrib.core'** -
Did you change your user model using `AUTH_USER_MODEL`? if so, you need to use that app's user model. – Brian Destura Apr 12 '22 at 02:16
-
@BrianDestura No I don't, how can I use this command `AUTH_USER_MODEL` ? – Rami Apr 12 '22 at 02:37
1 Answers
0
You should use
python manage.py changepassword <user_name>
manage.py changepassword username offers a method of changing a user’s password from the command line.

crimsonpython24
- 2,223
- 2
- 11
- 27
-
When I run `python manage.py changepassword
` I have this error **The syntax of the command is incorrect.** – Rami Apr 12 '22 at 02:16 -
2
-
Yeah it was meant to be a placeholder... my bad (this is provided that the admin's name is `admin`) – crimsonpython24 Apr 12 '22 at 02:21
-
I tried without `<` and `>` and this is the error : **CommandError: user 'admin' does not exist** – Rami Apr 12 '22 at 02:40
-