Example #1
0
from flask import Flask, render_template, redirect, url_for, request
import numpy
from pprint import pprint
import os

app = Flask(__name__)
app.debug = True
app.my_vars = {"state_count": 0}
from time import sleep


@app.route("/")
def hello_world():
    test_case_file = request.args.get("input")
    algorithm = request.args.get("algo")
    delay = request.args.get("delay")
    # print test_case_file,algorithm
    # os.system(" touch ./output/"+algorithm+"_"+test_case_file)
    # os.system("./bin/"+algorithm + " < ./input/"+test_case_file+" > ./output/"+algorithm+"_"+test_case_file)
    # sleep(2)
    with open("./output/" + algorithm + "_" + test_case_file) as f:
        s = f.read()
    moves = s.split("\n")[1]
    # print s, moves, "move"
    with open("./input/" + test_case_file) as f:
        s = f.read()
    s = s.split("\n")
    [height, width] = map(int, s[0].split(" "))
    grid = [[False for i in range(width)] for j in range(height)]
    targets = "["
    comma = False
Example #2
0
from flask import Flask, render_template, redirect, url_for, request

app = Flask(__name__)
app.my_vars = {"page_count": 0, "button_count": 0, "trust": False}

ADMIN_EMAIL = "a@b.com"
ADMIN_PWD = "pwd"


@app.route("/")
def counter_home_page():
    app.my_vars["page_count"] += 1
    count = app.my_vars["page_count"]
    button_count = app.my_vars["button_count"]
    trust = app.my_vars["trust"]
    return render_template(
        "home.html", count_variable_visible_in_template=count, i_trust_you=trust, button_count=button_count
    )


@app.route("/increment")
def button_pressed():
    app.my_vars["button_count"] += 1
    return redirect(url_for("counter_home_page"))


@app.route("/login", methods=["GET", "POST"])
def login():
    method = request.method
    email = request.form.get("email")
    password = request.form.get("password")