stack overflow.
I'm trying to run some simple bash script (.sh) from Django view.
My views.py:
def start_stop(request):
subprocess.Popen(['/home/ubuntu/contacts/contacts/scripts/test.sh'], shell=True)
result = 'Success'
return HttpResponse(result)
My bash script test.sh:
echo "testing text"
source /home/ubuntu/contacts/ENV/bin/activate
cd /home/ubuntu/contacts/contacts/scripts/
python final_poster.py
My main goal is activate the virtualenv and start python script name "final_poster.py". But it doesn't work. I also tried to use subprocess.call without any success result. I am stuck on it, can you help me?