Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在使用 django shell 时使以下 ipython 命令永久化:
%load_ext autoreload %autoreload 2
不幸的是,Django 似乎没有使用我的全局 ipython 配置,因此将它们放在我的 default_profile 中似乎不起作用。运行 django shell 时有什么方法可以自动执行这些?
您可以使用django 扩展包,其中包含一个shell_plus命令。此命令自动加载模型,但您也可以使用该--notebook属性。在那里您可以添加自动加载参数:--ext django_extensions.management.notebook_extension.
shell_plus
--notebook
--ext django_extensions.management.notebook_extension
请参阅此处了解更多信息。