I am trying to run a script in Django. This script needs to be run with sudo and I have setup the sudoers file so that the command can be executed without entering the sudo password. When I am using the default test server, ie >python manage.py runserver 0.0.0.0:8000, the script executes with no problem. However, after deploying Django with Nginx and uWSGI, the command fails and returns the response
sudo: no tty present and no askpass program specified
Is there some sort of configuration that I have missed?
I am using subprocess to execute the script and the code inside the Django view is like this:
subprocess.check_output( "sudo /path/to/file/fileName.sh", shell=True)