I am building a new extension that when a person clicks “submit” button, all of their data will be uploaded to a git repo. I would like to automatically execute, “git add . ; git commit -m “t”; git push origin” whenever a person clicks the button. However, I do not know how to to access shell/terminal and execute the commands. Is there a better way to do this? How do I execute those commands without having the user manually open up a terminal and executing the commands.
You use the subprocess module, or else a git library like GitPython. And you need to solve the permissions (key management) problem.
How would I use subprocess module in an extension. Whenever I try to import such a module, it complains. Do I need to create a “server extension”?
Yes, you’ll need some code on the server to actually run the server commands you want to run, so you’ll need a server extension.