【问题标题】:How to change django manage.py default shell如何更改 django manage.py 默认 shell
【发布时间】:2018-11-07 22:29:35
【问题描述】:

我刚刚安装了Anaconda,执行后有什么烦人的:

python manage.py shell

使用了 IPython shell。我想把它改回默认的 Python 发行版。我正在使用 Visual Studio Code,并且已经将它的解释器更改为默认的 python 3.6。此外,

python

command运行正常的python发行版,Visual Studio和正常的cmd终端都存在问题。

【问题讨论】:

    标签: python django shell anaconda ipython


    【解决方案1】:

    Django 1.10+:

    python manage.py shell --interface python
    

    Django

    python manage.py shell --plain
    

    【讨论】:

      【解决方案2】:

      我不知道你是否使用过 shell_plus。

      install django-extensions,然后使用python manage.py shell_plus

      shell plus 是一个非常棒的工具。

      你可以使用 shell / shell_plus 来拥有一个简单的界面

      python manage.py shell_plus --plain
      

      注意:- 不建议在 prod 版本中使用 django-extension。但我相信你会喜欢 shell_plus,因为这会减少导入所有模型的麻烦。

      【讨论】:

      • 我知道这个答案,只是我更喜欢使用原始外壳。至少要知道如何在原始、anaconda 和 shell-plus shell 之间进行转换。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-13
      • 1970-01-01
      • 2014-08-29
      • 2017-01-13
      • 2019-01-18
      • 2014-06-18
      • 1970-01-01
      相关资源
      最近更新 更多