Django's manage.py shell won't indent

狂风中的少年 提交于 2019-12-02 02:20:33

问题


I seem to have run into a strange bug or more likely some setting I am unfamiliar with on my system that is not allowing me to tab when I am in Django's shell (python manage.py shell is how I run it).

For obvious reasons this is proving to be annoying since I can't do any loops or conditonals in the shell. If I hit tab it completes all functions that are available to me, like bash does in a terminal. I've tried just using spaces for my indents but I always get an indentation error.

Does anyone know why this is happening and what I can do to get tab to work in my shell again? (It may be relevant to know that this is on a Ubuntu 9.04 system).

Edit: tab works fine in the regular pythong shell, it's only in django's that it doesn't.

Thanks.


回答1:


I'm guessing normally when you run python it's invoking something like ipython instead because the normal stock interpreter does not do tab-completion. It should pick up ipython automatically and use it, though. Try firing up a plain python interpreter (just run python at the command line) and running

import IPython

If you can do that, manage.py should use ipython. If not, maybe reinstall ipython as it would appear that the IPython module didn't get properly installed.



来源:https://stackoverflow.com/questions/2877472/djangos-manage-py-shell-wont-indent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!