由于无法在TTY中工作,因此无法在django中创建超级用户

PJM*_*PJM 8 python eclipse django tty

我从djangoproject.com开始第一个django教程,在第2部分的最开始,我在运行时创建超级用户,"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.    
Run Code Online (Sandbox Code Playgroud)

我在运行后继续创建超级用户时收到相同的消息syncdb.

我正在使用Eclipse for Windows 7,以及Django 1.7.1和Python 2.7.8.

Siv*_*Siv 9

当使用Git Bash并纠正上述错误消息时,请尝试追加winpty
,例如:

$ winpty python manage.py createsuperuser
Username (leave blank to use '...'):
Run Code Online (Sandbox Code Playgroud)


ksz*_*szl 5

您可以使用 django shell 创建超级用户 ( python manage.py shell)

from django.contrib.auth.models import User
User.objects.create_superuser(username='YourUsername', password='hunter2', email='your@email.com')
Run Code Online (Sandbox Code Playgroud)


don*_*yor 4

如果您在 virtualenv 中,cd请进入您的 virtualenv 并激活它。然后尝试以下步骤:

python manage.py syncdb --noinput
python manage.py migrate
python manage.py createsuperuser
Run Code Online (Sandbox Code Playgroud)

  • 使用命令行工具代替eclipse中的自定义命令 (3认同)