Exemplo n.º 1
0
from flask import Flask, render_template, send_from_directory

import pandas

from buildui import make_ui

here = path.abspath(path.dirname(__file__))

app = Flask(__name__)

ui = make_ui(here+"/fitbit_data.csv")
ui.render_layout(app, "./demo/static/layout.js")

# Create a webpack file and bundle our javascript
from pyxley.utils import Webpack
wp = Webpack(".")
wp.create_webpack_config(
    "layout.js",
    "./demo/static/",
    "bundle",
    "./demo/static/"
)
wp.run()


css = [
    "./css/main.css"
]

@app.route('/', methods=["GET"])
def index():
Exemplo n.º 2
0
if args.build:
    build = True

_views = {}
_views["main"] = MainView(cache, save=build)

if args.build:
    _apps = {
        "Main": {
            "route": "/",
            "filename": "layout.js"
        }
    }
    ReactRouter(_apps, "component_id", static_path=static_+"/index.js")

    wp = Webpack(".")
    wp.run()

for v in _views.values():
    app.register_blueprint(v.mod)

@app.route('/health_check', methods=["GET"])
def health_check():
    return jsonify({"result": "wubbalubbadubdub"})

import time
def check_status():
    cache.status()
    for v in _views:
        if v == "feedback":
            continue
Exemplo n.º 3
0
choices = ["Heart Rate", "Pace", "Distance"]
btn = SelectButton("Data", choices, "Data", "Heart Rate")
ui.add_filter(btn)

# Add our new chart
colors = ["#847c77", "#ff5c61"];
nc = NewChart("Seconds", "value", "Altitude", df,
    init_params={"Data": "Heart Rate"}, colors=colors)
ui.add_chart(nc)

app = Flask(__name__)
sb = ui.render_layout(app, "./project/static/layout.js")

# Use the webpack file in the dir and bundle our javascript
from pyxley.utils import Webpack
wp = Webpack(".")
wp.run()

@app.route('/', methods=["GET"])
@app.route('/index', methods=["GET"])
def index():
    _scripts = ["./bundle.js"]
    return render_template('index.html',
        title=TITLE,
        base_scripts=scripts,
        page_scripts=_scripts,
        css=css)

if __name__ == "__main__":
    app.run(debug=True)