Super user is being created successfully with --noinput
option, but login does not work in admin site.
DJANGO_SUPERUSER_PASSWORD=123#$asdWE
python manage.py createsuperuser --noinput --username admin --email [email protected]
login of a superuser without --noinput
(manual password typing) is working as expected.
CodePudding user response:
just creating a superuser successfully doesn't mean you have a superuser with the ability of logging into the admin page. first you should check if the password correctly set or not maybe you are setting the environment variable in a wrong way and the password didn't set so you can test it by changing the password in shell and retry to login to admin page don't forget to use set_password function to change password
CodePudding user response:
Take a look, the char #
is truncating the password.
#BAD
dani@dani / % DJANGO_SUPERUSER_PASSWORD=123#$asdWE
dani@dani / % echo $DJANGO_SUPERUSER_PASSWORD
123#
Solution: Use quotes, also, export the env var:
#OK
dani@dani / % export DJANGO_SUPERUSER_PASSWORD='123#$asdWE' #<- quotes
dani@dani / % echo $DJANGO_SUPERUSER_PASSWORD
123#$asdWE