Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <ol> <li>Would like advice on how to debug why this is not working.</li> </ol> </blockquote> <p>You can use the <a href="https://docs.djangoproject.com/en/dev/topics/logging/#module-django.utils.log" rel="nofollow">python / django logging mechanism</a> and throw logging information wherever needed. In short:</p> <pre><code>import logging logger = logging.getLogger(__name__) # Get an instance of a logger my_custom_command = "/usr/local/build " + self.site + ' ' + self.num + ' ' + self.octet logger.warning(my_custom_command) </code></pre> <p>prints a warning message to console. If you use the <a href="https://pypi.python.org/pypi/django-debug-toolbar" rel="nofollow">django debug toolbar (highly recommended!)</a>, you can easily log using the .debug-level (not .warning) and see the results on the web page.</p> <p>You can include those logging messeges on every intended step of your work flow and check whether everything is as it should be.</p> <p>I'm doing something like this (compiling c-code which is prvided by the user) using the following code snipplet:</p> <pre><code> try: cfile = os.path.join(MEDIA_ROOT, 'temp/src/cfile.c') ofile = os.path.join(MEDIA_ROOT, 'temp/src/cfile.o') efile = os.path.join(MEDIA_ROOT, 'temp/src/cfile.exe') command_string = 'gcc -O0 -g3 -Wall -c -fmessage-length=0 ' + cfile + ' -o ' + ofile compile_result = subprocess.check_output(command_string,stderr=subprocess.STDOUT,shell=True) if compile_result != "": #Compile error self.ausgabe = "Compile:\n" self.ausgabe += str(compile_result) except: self.ausgabe = u"Compilierfehler:\n" self.ausgabe += str(compile_result) </code></pre> <p>(please ignore the German words, they are not important for understanding the logic)</p> <p>One additional thing which might be important is to use correct encoding for all strings. </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.
 

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