在iPython和Django中使用配置文件

Bry*_*ock 3 python django ipython

我有一个Django产品,我正在使用iPython进行交互.

我正在尝试在启动shell时自动加载模块:

python manage.py shell

我已将.ipython/ipythonrc复制到项目的根目录并添加到文件中:

import_some module_name model1 model2

但是,当我启动shell时,这些名称没有被加载.

我究竟做错了什么?

Ben*_*end 5

我不知道ipythonrc,但如果你只需要模型,你可以使用django-extensions.安装它之后,你会得到大量新的管理命令,包括shell_plus,它将打开一个ipython会话并自动加载你的所有模型:

python manage.py shell_plus
Run Code Online (Sandbox Code Playgroud)