# -*- coding: utf-8 -*- from flask import Flask, Response, render_template, url_for from log_colorizer import make_colored_stream_handler from logging import getLogger, INFO, DEBUG from moulinrouge.data import labels, series # from pygal.bar import VerticalBar, HorizontalBar from pygal.line import Line from pygal.bar import Bar from pygal.config import Config from pygal.style import styles # from pygal.pie import Pie import string import random def random_label(): chars = string.letters + string.digits + u' àéèçêâäëï' return ''.join( [random.choice(chars) for i in range( random.randrange(4, 30))]) def random_value(min=0, max=15): return random.randrange(min, max, 1) # def generate_vbar(**opts): # g = VerticalBar(labels, opts) # for serie, values in series.items(): # g.add_data({'data': values, 'title': serie}) # return Response(g.burn(), mimetype='image/svg+xml') def create_app(): """Creates the pygal test web app""" app = Flask(__name__) handler = make_colored_stream_handler() getLogger('werkzeug').addHandler(handler) getLogger('werkzeug').setLevel(INFO) getLogger('pygal').addHandler(handler) getLogger('pygal').setLevel(DEBUG) @app.route("/") def index(): return render_template('index.jinja2') @app.route("/all--