我想在我测试python manage.py shell
中的东西时省去一些键入操作。基本上我有一个shell脚本让我进入>>>
shell,但我希望能够在我的views.py脚本中自动推入导入调用,所以我不必每次输入它们时都要输入它们测试一下。我试图在shell脚本中写出它们,但它似乎没有传递给python shell。Shell脚本Python Shell导入
这是我到目前为止。
#!/usr/local/bin/bash
python ~/path/to/manage.py shell
import datetime
from django.shortcuts import render_to_response
from mymodel.models import *
from myapp.forms import *
... and so on
我想什么发生是所有进口线被推入到Python Shell中,所以我不必键入/他们复制粘贴,每次我想在shell调试。
3分钟3回答。周五晚上的回复率很好。 – 2013-02-23 02:55:16
只有真正的极客在星期五这晚很晚:) – Brandon 2013-02-23 02:57:14