Application Details: Ubuntu 16.04 + flask + nginx + uwsgi
I am trying to execute a bash command from flask application.
@app.route('/hello', methods=('GET', 'POST'))
def hello():
os.system('mkdir my_directory')
return "Hello"
The above code run successfully but doesn't create any directory. Also it creates directory on my local which doesn't have any nginx level setup.
I also tried following ways:
- subprocess.call(['mkdir', 'my_directory']) # Throws Internal server error
- subprocess.call(['mkdir', 'my_directory'],shell=True) # No error but directory not created
- subprocess.Popen(['mkdir', 'my_directory']) # Throws Internal server error
- subprocess.Popen(['mkdir', 'my_directory'],shell=True) # No error but directory not created
Do I need any nginx level configuration changes.