def render_output_website():
    """ Render the output template website.

    This is messy last minute code. Sorry :(
    """
    from jinja2 import Environment, PackageLoader
    env = Environment(loader=PackageLoader('looksee', 'templates'))
    connection = tasa.store.connection
    containers = {}
    uris = connection.hgetall('container_uris')
    for key, value in uris.items():
        containers[key] = {'uri': value}
    pipe = connection.pipeline()
    queue_names = ['masscan', 'masscan_out', 'rfb_print']
    for name in queue_names:
        pipe.llen(name)
    queue_lengths = pipe.execute()
    queues = zip(queue_names, queue_lengths)
    for key in uris.keys():
        pipe.hgetall('container_' + key)
    for key, value in zip(uris.keys(), pipe.execute()):
        containers[key]['files'] = value
    template = env.get_template('container_index.html')
    rendered = template.render(containers=containers, queues=queues)
    with open('www/index.html', 'w') as f:
        f.write(rendered)
    template = env.get_template('inner_index.html')
    for key in containers.keys():
        rendered = template.render(base_uri=containers[key]['uri'],
                                   files = containers[key]['files'])
        with open('www/%s.html' % key, 'w') as f:
            f.write(rendered)

# Since this is used as both a module and a shell script, only parse
# arguments if it is called directly...
dataset/ETHPy150Open PaulMcMillan/toorcon_2013/configurator/looksee/looksee.py/render_output_website/original