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

问题描述 投票:8回答:6

我从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.    

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

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

python django eclipse tty
6个回答
8
投票

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

$ winpty python manage.py createsuperuser
Username (leave blank to use '...'):

4
投票

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

python manage.py syncdb --noinput
python manage.py migrate
python manage.py createsuperuser

2
投票

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

from django.contrib.auth.models import User
User.objects.create_superuser(username='YourUsername', password='hunter2', email='[email protected]')

1
投票

我是Windows10用户。我尝试使用py manage.py createsuperuser控制台运行Git Bash命令,但错误已被抛出。然后我用管理员权限将Git Bash切换到本机Windows Command Line,并重新运行命令 - 它正在工作。


0
投票

使用“Windows PowerShell”或“Windows Cmd”,然后使用相同的命令。 Git命令界面有一些限制。


0
投票

第一次运行

cmd提示符中的$ django-admin startproject mysite,然后应用迁移

cd然后我的:

python manage.py makemigrations然后

python manage.py之后迁移

python manage.py createsuperuser

© www.soinside.com 2019 - 2024. All rights reserved.