2015-11-02 48 views
0

的Python代碼爲我的Django的項目,我必須與subprocess合作,打開manage.py shell和執行Python代碼那樣打開外殼,並執行與面料

proc = subprocess.Popen([ 
    manage, "shell", 
], stdin=subprocess.PIPE) 
proc.communicate(
    "from django.contrib.auth.models import User; ..." 
    ) 
) 

現在,我想與fabric做到這一點的腳本。我如何運行manage.py shell,並使用fabric在那裏放置一些代碼?

回答