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.
当使用Git Bash并纠正上述错误消息时,请尝试追加winpty
,例如:
$ winpty python manage.py createsuperuser
Username (leave blank to use '...'):
Run Code Online (Sandbox Code Playgroud)
您可以使用 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)
如果您在 virtualenv 中,cd请进入您的 virtualenv 并激活它。然后尝试以下步骤:
python manage.py syncdb --noinput
python manage.py migrate
python manage.py createsuperuser
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12543 次 |
| 最近记录: |