How can I display my python file in html?
<p>I'm using flask, tried different examples, many codes but nothing worked .. </p>

<p>this is my html: </p>

<pre><code>&lt;form method="post" name="prueba"&gt;

                        &lt;div class="form-group "&gt;
                            &lt;label class="col-sm-3 col-sm-3 control-label"&gt;Direccion IP: &lt;/label&gt;
                            &lt;div class="col-sm-9"&gt;
                                 &lt;input type="text" class="form-control" value="{{ address }}" &gt;
                             &lt;/div&gt;
                         &lt;/div&gt;
</code></pre>

<p>python file:</p>

<pre><code>def get_info():

    with open('/etc/network/interfaces', 'r+') as f:
        for line in f:
            found_address = line.find('address')
            if found_address != -1:
                address = line[found_address+len('address:'):]
                print 'Address: ', address
            found_network = line.find('network')
            if found_network != -1:
               network = line[found_network+len('network:'):]
               print 'Network: ', network
            found_netmask = line.find('netmask')
            if found_netmask != -1:
               netmask = line[found_netmask+len('netmask:'):]
               print 'Netmask: ', netmask 
            found_broadcast = line.find('broadcast')
            if found_broadcast != -1:
               broadcast = line[found_broadcast+len('broadcast:'):]
               print 'Broadcast: ', broadcast
    return address 
print get_info()

@app.route('/test')
def showPage():
    addresses = get_info()
    return render_template('test.html', addresses=addresses)
</code></pre>

<p>python file works correctly when I run it through console but when I try to display it inside my form nothing happens.</p>

<p>Could it be that you provide the data to the template as <code>addresses</code> but you call the variable in your template <code>address</code>?</p>

python html python-2.7 flask debian