Trying to create a super user for my database:
manage.py createsuperuser
Getting a sad recursive message:
Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser
in your project to create one manually.
Seriously Django? Seriously?
The only information I found for this was the one listed above but it didn't work: Unable to create superuser in django due to not working in TTY
And this other one here, which is basically the same: Can't Create Super User Django
If you run
$ python manage.py createsuperuser
Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser
in your project to create one manually.
from Git Bash and face the above error message try to append winpty
i.e. for example:
$ winpty python manage.py createsuperuser Username (leave blank to use '...'):
To be able to run python
commands as usual on windows as well what I normally do is appending an alias line to the ~/.profile
file i.e.
MINGW64 ~$ cat ~/.profile
alias python='winpty python'
After doing so, either source the ~/.profile
file or simply restart the terminal and the initial command python manage.py createsuperuser
should work as expected!
I had same problem when trying to create superuser in the docker container with command:
sudo docker exec -i <container_name> sh
. Adding option -t solved the problem:
sudo docker exec -it <container_name> sh
来源:https://stackoverflow.com/questions/32532900/not-able-to-create-super-user-with-django-manage-py