Demo entry 6362263

Application

   

Submitted by anonymous on May 08, 2017 at 14:28
Language: Python. Code size: 777 Bytes.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2017, Andrew Ernest Ritz.
License: MIT
"""

from bottle import route, run, request, default_app
from librender import get_all_variables, neteval, get_responses, templateEnv
from jinja2 import Environment, FileSystemLoader

all_vars = get_all_variables()


@route('/application')
def api():
    global templateEnv, all_vars

    template_name = 'template-cluster.html'
    template = templateEnv.get_template(template_name)

    hostmap = neteval(all_vars[template_name])
    res = get_responses(hostmap)

    return template.render(res)


application = default_app()


if __name__ == '__main__':

    run(app=application, host='0.0.0.0', port=5000, debug=True, server='waitress')

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).