Example #1
import docker
from flask import Flask, render_template, session, g, redirect
from flask.ext.bootstrap import Bootstrap

import psutil
import requests

from flask.ext.openid import OpenID
import sqlite3dbm

app = Flask(__name__)
app.secret_key = "arglebargle"
oid = OpenID(app, os.path.join(os.path.dirname(__file__), "openid_store"))

app.config["BOOTSTRAP_USE_MINIFIED"] = True
app.config["BOOTSTRAP_USE_CDN"] = True
app.config["BOOTSTRAP_FONTAWESOME"] = True
app.config["SECRET_KEY"] = "devkey"

CONTAINER_STORAGE = "/usr/local/etc/jiffylab/webapp/containers.json"
BASE_IMAGE = "ytproject/yt-devel"
BASE_IMAGE_TAG = "jiffylab"

# or can use available for vm
initial_memory_budget = psutil.virtual_memory().free

# how much memory should each container be limited to, in k.
CONTAINER_MEM_LIMIT = 1024 * 1024 * 128
# how much memory must remain in order for a new container to start?
Example #2
#!/usr/bin/env python
# coding=utf8

from flask import Flask, url_for, render_template
from flask.ext.bootstrap import Bootstrap
from flask.ext.wtf import Form, TextField, HiddenField, ValidationError, Required

app = Flask(__name__)

app.config["BOOTSTRAP_USE_MINIFIED"] = False
app.config["SECRET_KEY"] = "devkey"

class ExampleForm(Form):
    field1 = TextField("First Field", description="This is field one.")
    field2 = TextField("Second Field", description="This is field two.", validators=[Required()])
    hidden_field = HiddenField("You cannot see this", description="Nope")

    def validate_hidden_field(form, field):
        raise ValidationError("Always wrong")

@app.route("/", methods=("GET", "POST"))
def index():
    form = ExampleForm()
    if form.validate_on_submit():
        return "PASSED"
    return render_template("example.html", form=form)