title: I'm having trouble displaying output on my python code for network monitoring. Not displaying result but no error
body: <p>I have a project that needs to monitor all the connected devices over the network. Data must be displayed in Django. I have this code no error but not displaying anything. I don't know if I have missed something.</p>
  
  <p>network_tag.py</p>
  
  <pre><code>import sys
  import logging
  import netifaces as ni
  import nmap
  import threading
  import socket
  import subprocess
  from django import template
  from collections import namedtuple
  register = template.Library()
  
  deviceTuple = namedtuple('deviceTuple',
                        'ip, mac')
  
  class NetworkScanner(template.Node):
      """docstring for NetworkScanner."""
  
      def get_interfaces(self):
          #log.info('Getting local interfaces...')
          interfaces = []
          for interface in ni.interfaces():
              if not interface.startswith(('lo', 'vir')):
                  #log.info('Found local interface {}'.format(interface))
                  interfaces.append(interface)
          return interfaces
  
      def get_local_ip(self):
          interfaces = self.get_interfaces()
          #log.info('Getting local ip address...')
          for interface in interfaces:
              try:
                  addr = ni.ifaddresses(interface)[2][0]['addr']
                  #log.info('Local ip address is {}'.format(addr))
                  return addr
              except KeyError:
                  #log.debug('Error: No local ip addresses found.')
                  return ''
  
      def get_subnet(self):
          ip = self.get_local_ip()
          subnet = '.'.join(ip.split('.')[:3]) + '.0/24'
          #log.info('Subnet is {}'.format(subnet))
          return subnet
  
      def render(self, context):
  
          subnet = self.get_subnet()
          #log.info('Getting devices on subnet {}...'.format(subnet))
          nmap_args = '-sP'
          scanner = nmap.PortScanner()
          scanner.scan(hosts=subnet, arguments=nmap_args)
  
          devices = list()
          for ip in scanner.all_hosts():
              if 'mac' in scanner[ip]['addresses']:
                  mac = scanner[ip]['addresses']['mac'].upper()
                  #device = {'ip': ip, 'mac':mac}
                  #log.info('Found device {}'.format(device))
                  devices.append(deviceTuple(
                          ip=ip.ip,
                          mac=ip.mac))
          #log.info('Found {} devices'.format(len(devices)))
          #return devices
  
  
          all_stats = {
              'devices': devices
          }
  
          context.update(all_stats)
  
          return ''
  
  @register.tag
  def get_system_stats(parser, token):
      return NetworkScanner()
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>{% extends "admin/index.html" %}
  {% load network_tag %}
  {% block content %}
  {% get_system_stats %}
  &lt;style&gt;
      .graph { 
          background-color: #B1D632;
          position: relative;
          width: 98%; 
          border: 1px solid #666;
          padding: 1px;
      }
      .graph .bar { 
          display: block;
          padding: 1px;
          position: relative;
          background: #ff0002;
          text-align: center; 
          color: #ffffff;
          height: 1em; 
          line-height: 1em;
      }
      .graph .bar span { position: absolute; left: 1em; }
  &lt;/style&gt;
  
  {% if user.is_superuser %}
  &lt;div class="module"&gt;
  
      &lt;p&gt;Test 1:  {{ devices.mac }}&lt;/p&gt;
  
  &lt;/div&gt;
  {% endif %}
  {{ block.super }}
  {% endblock %}
  </code></pre>
  
  <p>Result must be:
  all ip addresses scanned an its mac address equivalence</p>