I want to be able to execute some shell commands like mkvirtualenv and createdb and such from a Django app, these processes will likely go into a Django celery task later. I would think using system() would be insecure to execute shell commands from Django/Apache, so my question is what is the best way to execute shell commands from a django app?
asked May 21, 2012 at 15:43
jeffci
2,6446 gold badges38 silver badges60 bronze badges
-
2you could use the subprocess module: stackoverflow.com/a/546024/630877arie– arie2012年05月21日 16:00:52 +00:00Commented May 21, 2012 at 16:00
-
arie, thanks, I will use that. Can you answer below so I can mark your answer?jeffci– jeffci2012年05月22日 13:11:44 +00:00Commented May 22, 2012 at 13:11
-
1I turned my comment into an answer. Happy subprocessing!arie– arie2012年05月22日 15:25:12 +00:00Commented May 22, 2012 at 15:25
1 Answer 1
To start a shell process in the background you can use the subprocess module.
answered May 22, 2012 at 14:40
arie
19k5 gold badges73 silver badges76 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default