I am working on a home automation project, and I want to run certain python codes when going to certain URLs of my Django Webpage. The subprocess.call() line from my Django Views.py works perfectly on my Django development server:
from django.http import HttpResponse import subprocess def home(): subprocess.call(['python','path_to_python_file/python_file.py']) html = "<html><h1>Hello World</h1></html>" return HttpResponse(html)
But the python script (or whatsoever command line) is not called on my Raspberry with Apache. According to many previous questions I've read, this could either be a SELinux issue or an premission issue (the Django/Apache user and group does not have permission to run commands).
Anyone can give me a hand on how to check whether this is caused by one or the other, and how to either configure SELinux or giving permission to Django/Apache to run commands?