Django的manage.py shell不会缩进 [英] Django's manage.py shell won't indent

查看:142
本文介绍了Django的manage.py shell不会缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎遇到了一个奇怪的错误,或者更可能是我在系统上不熟悉的一些设置,当我在Django的shell中( python manage.py shell 是我如何运行它)。



由于显而易见的原因,这被证明是恼人的,因为我不能在shell中执行任何循环或条件。如果我点击选项卡,它会完成我可用的所有功能,如终端中的bash。我试过只是使用空格为我的缩进,但我总是得到缩进错误。



有谁知道为什么会发生这种情况,我可以做什么来获得标签再次在我的shell中工作? (知道这是在Ubuntu 9.04系统上可能是相关的)。



编辑:选项卡在常规pythong shell中工作正常,



谢谢。

解决方案

p>当你运行 python 时,我正在猜测,它正在调用类似于 ipython 的代码,因为正常的库存解释器不做标签完成。它应该自动选择ipython并使用它,虽然 。尝试点击一个简单的python解释器(只需在命令行运行 python )并运行

  import IPython 

如果可以这样做,管理。 py 应该使用ipython。如果没有,可能会重新安装ipython,因为看起来, IPython 模块未正确安装。


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.

解决方案

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.

这篇关于Django的manage.py shell不会缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆