Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em>Why this code doesn't work is explained in another answer, I'm just answering his questions for the next time something like this happens.</em></p> <blockquote> <p>Would like advice on how to debug why this is not working.</p> </blockquote> <pre class="lang-py prettyprint-override"><code>def create_conf(sender, **kwargs): import pdb pdb.set_trace() os.system("/usr/local/build " + self.site + ' ' + self.num + ' ' + self.octet) </code></pre> <p>This will give you the built-in Python debugger, in the console runserver is running. With it, you can go trough your code step by step, and execute regular Python commands (like print).</p> <p>Read up on the commands for inside the debugger <a href="http://docs.python.org/2/library/pdb.html#debugger-commands" rel="nofollow">here</a> Some IDEs come with Python debugging support, and present it with a nice GUI.</p> <p>When using it a lot: use the oneliner:</p> <pre class="lang-py prettyprint-override"><code>import pdb; pdb.set_trace; # yes, Python supports semicolons # (although its not recommended) </code></pre> <hr> <blockquote> <p>And to make sure that the strings are being passed through from django web page to arguments on cmd application.</p> </blockquote> <p>You can either:</p> <p>cast them to strings to make sure</p> <pre class="lang-py prettyprint-override"><code>os.system("/usr/local/build " + str(self.site) + ' ' + str(self.num) + ' ' + str(self.octet)) </code></pre> <p>or use the string formatter (which is better than using the + sign and makes sure input gets cast to strings)</p> <pre class="lang-py prettyprint-override"><code>os.system("usr/local/build {0} {1} {2}".format(self.site, self.num, self.octet)) </code></pre> <p>Read up on the string .format method <a href="http://docs.python.org/2/library/stdtypes.html#str.format" rel="nofollow">here</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload