how to pass realtime form arguments to a python script called by a django app
<p>my django app calls a python cgi script:</p>

<pre><code>def query(request):
    if request.method == 'GET':
    output = subprocess.check_output(['python', 'query.cgi']).decode('utf-8')
    return HttpResponse(output, content_type="text/html")
</code></pre>

<p>The query.cgi will be called by a form. How do I pass form args like "name=one&amp;type=two" to the cgi. When I do subprocess.check_output(['python', 'query.cgi', 'name=one', 'type=two']). It works, but how do I pass the realtime online form input to cgi? Thanks a lot!</p>

<p>They're passed in the <code>GET</code> dictionary from <code>request</code>:</p>

<pre><code>foo = request.GET['foo']
subprocess.check_output(['python', 'query.cgi', 'foo=' + foo])
</code></pre>

<p>You can also use</p>

<pre><code>request.GET.get('foo', 'def')
</code></pre>

<p>to have a default value if the key is missing.</p>

python django