Example #1
0
@app.route("/login", methods=["POST"])
def loginPost():
    # FIXME: check user credentials, if they're fine, then return the
    # user to the index page, if not, return the user to the loginGet
    # page with his inserted data.
    return redirect(url_for("index"))


@app.route("/")
def index():
    # FIXME: when templates are available, return the main page. if
    # there is a logged user, make sure to return him to his home
    # page.
    return render_template("index.html")


if __name__ == "__main__":
    user = connection.User()
    user["username"] = "******"
    user.save()

    # FIXME: when TODO 1 is implemented, add a debug switch and use it
    # here.
    # FIXME: when the debug switch is False, use app.run("0.0.0.0")
    app.debug = True
    # FIXME: use /dev/urandom and sha512sum to generate a secret key
    # FIXME: put the secret key an option in the profile settings
    app.secret_key = "foobar"
    app.run()