Why this code does not work is explained in another answer, I just answer his questions when the next time something like this happens.
I would like to advise how to debug, why this does not work.
def create_conf(sender, **kwargs): import pdb pdb.set_trace() os.system("/usr/local/build " + self.site + ' ' + self.num + ' ' + self.octet)
This will give you the built-in Python debugger on the console launch server. With it, you can step-by-step do your code and execute ordinary Python commands (for example, printing).
Read the commands for inside the debugger here. Some IDEs come with Python debugging support and present it with a good graphical interface.
For repeated use: use oneliner:
import pdb; pdb.set_trace;
And to make sure the strings are passed from the django webpage to the arguments in the cmd application.
You can:
translate them into lines to make sure
os.system("/usr/local/build " + str(self.site) + ' ' + str(self.num) + ' ' + str(self.octet))
or use a line formatter (which is better than using the + sign and ensures that the input will be passed to the lines)
os.system("usr/local/build {0} {1} {2}".format(self.site, self.num, self.octet))
Read the string.format method here
source share