Django ipython autoreload

来源:互联网 发布:相册视频制作软件 编辑:程序博客网 时间:2024/06/03 18:01

使用Django时,如果要测试单个python文件,需要使用python manage.py shell

但是如果修改了代码,需要退出,然后重新进入ipython环境,才可以加载新的代码

有没有办法自动重载修改后的代码?

官网的解决方案,但是试了一下并没有用。

有没有哪位大神知道为什么?

In [1]: %load_ext autoreloadIn [2]: %autoreload 2In [3]: from foo import some_functionIn [4]: some_function()Out[4]: 42In [5]: # open foo.py in an editor and change some_function to return 43In [6]: some_function()Out[6]: 43

官网解决地址:https://ipython.org/ipython-doc/3/config/extensions/autoreload.html

原创粉丝点击