0
我在我的本地系統中有一個結構文件,我使用它在遠程服務器(在virtualenv)中部署代碼並想測試它。方法定義如下所示。面料不是Django環境
def test_deploy(gitid = '930bfc4'):
# manually put the commit id at the end
path = '/tmp/testapp/app1/source/demo4'
with cd(path):
commit_id = 'git fetch https://[email protected]/myaccount/demo4.git/heads/master:https://[email protected]/myaccount/demo4.git/remotes/origin/master/'+gitid
# change the settings.py file and update the database
run (commit_id)
run ('cat .git/FETCH_HEAD')
path1 = '/tmp/testvehic/vehic'
with cd(path1):
run ('pwd')
env.activate = 'source /tmp/testapp/app1/bin/activate'
run ('python /tmp/testapp/app1/source/demo4/manage.py test')`
據顯示,
ImportError: No module named django.core.management
在谷歌一些搜索後,我才知道,它實際上沒有定位我的Django的環境。
我的虛擬環境路徑爲/tmp/testapp/app1
和源代碼是/tmp/testapp/app1/source/app1/
當我在服務器端的工作正常運行的命令python manage.py test
。我如何通過結構測試?
停止搭售激活的東西,太多的人弄錯了,做到這一點,而不是答案:'/ tmp/testvehic/vehic/bin/python /tmp/testapp/app1/source/demo4/manage.py test'它保證不會失敗;沒有人會看代碼並被它迷惑;更容易調試;沒有但贏得勝利! :P –