iPython - “损坏”重新加载 Django 后的 shell/终端
我将 iPython shell 嵌入到 Django 脚本中(带有开发服务器,例如本地主机上的 runserver),如下所示:
...
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()
...
这在所需位置提供了交互式 shell。现在,如果修改源代码,Django 会自动重新加载,可能没有正确退出 iPython shell,并“破坏”我的终端仿真器(xterm、konsole) - 文本变得不可见等(如果在 Django 中运行的 iPython 用 Ctrl 终止,则效果相同) +d)。
有什么建议可能导致这种情况吗? (我可能以错误的方式使用 iPython,但谁知道呢)。
I'm embedding iPython shell in a Django script (with development server, e.g. runserver at localhost) like this:
...
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()
...
which gives me interactive shell at the desired place. Now, if modify the source code, Django automatically reloads, probably without correctly quitting iPython shell, and "breaks" my terminal emulator (xterm, konsole) - text becomes invisible, etc. (same effect if iPython running inside Django is terminated with Ctrl+d).
Any suggestions as what could be causing this? (I'm probably using iPython in a wrong way, but who knows).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法回答为什么会出错的问题,但我可以告诉您如何从中恢复:退出调试服务器并发出
reset
命令。防止这种情况发生的另一种方法是在
runserver
命令上使用--reload
开关。这意味着 Django 不会在更改后重新加载,但也不会破坏您的调试器。I cannot answer the question why it's going wrong, but I can tell you how to recover from it: quit the debugging server and give the
reset
command.Another way to prevent this from happening is to use the
--reload
switch on therunserver
command. This means that Django will not reload after a change, but it also doesn't break your debugger.此问题已修复: http://code.djangoproject.com/ticket/15565
谢谢 Django 。
This issue is already fixed: http://code.djangoproject.com/ticket/15565
Thanks Django.