Not able to create super user with Django manage.py(无法使用 Django manage.py 创建超级用户)
问题描述
尝试为我的数据库创建超级用户:
Trying to create a super user for my database:
manage.py createsuperuser
得到一个悲伤的递归消息:
Getting a sad recursive message:
由于未在 TTY 中运行,已跳过创建超级用户.您可以在项目中运行 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.
真的是 Django 吗?认真的吗?
Seriously Django? Seriously?
我找到的唯一信息是上面列出的信息,但它不起作用:由于无法在 django 中创建超级用户不能在 TTY 中工作
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
这里还有一个,基本一样:无法创建超级用户 Django
And this other one here, which is basically the same: Can't Create Super User Django
推荐答案
如果你运行
$ 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.
 从 Git Bash 并面对上述错误消息尝试附加 winpty 即例如:
 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 '...'):
为了能够像往常一样在 Windows 上运行 python 命令,我通常所做的是将别名行附加到 ~/.profile 文件,即 
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'
这样做之后,要么获取 ~/.profile 文件,要么只是重新启动终端,初始命令 python manage.py createsuperuser 应该会按预期工作!
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!
这篇关于无法使用 Django manage.py 创建超级用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法使用 Django manage.py 创建超级用户
				
        
 
            
        - python-m http.server 443--使用SSL? 2022-01-01
 - pytorch 中的自适应池是如何工作的? 2022-07-12
 - 如何将一个类的函数分成多个文件? 2022-01-01
 - 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
 - padding='same' 转换为 PyTorch padding=# 2022-01-01
 - python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
 - 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
 - 沿轴计算直方图 2022-01-01
 - 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
 - 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
 
				
				
				
				