python manage.py runserver,shell,dbshell 在 git-bash 上冻结
python manage.py runserver, shell, dbshell freezes on git-bash
我正在 git-bash 上 python virtualenv windows 中尝试 运行 交互式 shell,但是这不是 运行ning。奇怪的是,它似乎没有做任何事情,只是光标在下一行闪烁,没有输出。
$ python manage.py shell
|
但是,我能够 运行 命令,例如 - migrate、makemigrations、sqlmigrate。命令出现问题 - shell、dbshell、运行server。
这似乎是一些 git-bash 相关的问题,因为我可以从命令行 运行 shell。我在 windows 上使用 PortableGit-2.4.3.1-2nd-release-candidate-64-bit.7z.exe
。
在评论中总结调查...
调查此类问题的一个好方法是使用 pystuck。
在这种情况下,它似乎是对 IPython 的某种内部依赖,因为安装 pystuck 也会安装 IPython,并且安装了两者后该错误不再重现。
我不知道命令 shell
和 dbshell
,但是对于 runserver
命令,我有同样的问题。我解决了运行
python manage.py runserver --noreload
转到 http://127.0.0.1:8000/ 并刷新浏览器。您的终端必须显示您网站的信息
问题是 python.exe 本身与 gitbash 有问题。估计跟ncurses库有关系。
解决方案是键入 "winpty python.exe" 而不是 python。 "winpty python.exe manage.py shell" 应该可以。您还可以创建一个别名来绕过这个问题。输入 "alias python='winpty python.exe'" 将使 "python manage.py shell" 正常工作。
这个答案解释得更好:
Python not working in the command line of git bash
如果你去 http://127.0.0.1:8000/ 你会发现它工作正常
我正在 git-bash 上 python virtualenv windows 中尝试 运行 交互式 shell,但是这不是 运行ning。奇怪的是,它似乎没有做任何事情,只是光标在下一行闪烁,没有输出。
$ python manage.py shell
|
但是,我能够 运行 命令,例如 - migrate、makemigrations、sqlmigrate。命令出现问题 - shell、dbshell、运行server。
这似乎是一些 git-bash 相关的问题,因为我可以从命令行 运行 shell。我在 windows 上使用 PortableGit-2.4.3.1-2nd-release-candidate-64-bit.7z.exe
。
在评论中总结调查...
调查此类问题的一个好方法是使用 pystuck。
在这种情况下,它似乎是对 IPython 的某种内部依赖,因为安装 pystuck 也会安装 IPython,并且安装了两者后该错误不再重现。
我不知道命令 shell
和 dbshell
,但是对于 runserver
命令,我有同样的问题。我解决了运行
python manage.py runserver --noreload
转到 http://127.0.0.1:8000/ 并刷新浏览器。您的终端必须显示您网站的信息
问题是 python.exe 本身与 gitbash 有问题。估计跟ncurses库有关系。
解决方案是键入 "winpty python.exe" 而不是 python。 "winpty python.exe manage.py shell" 应该可以。您还可以创建一个别名来绕过这个问题。输入 "alias python='winpty python.exe'" 将使 "python manage.py shell" 正常工作。
这个答案解释得更好: Python not working in the command line of git bash
如果你去 http://127.0.0.1:8000/ 你会发现它工作正常