Example #1
def base_app():
    global app
    app = Flask("backend")
    app.config.overrides = {}

    logging.info("Connecting to database...")
    engine = create_engine(backend.settings.db_connection)
    app.engine = engine
    base = automap_base()
    base.prepare(engine, reflect=True)

    session = Session(engine)
    app.base = base
    app.session = session
    app.Decl_Base = declarative_base()

    from backend.models import Members


    # Create the Flask-Restless API manager.
    app.api_manager = flask.ext.restless.APIManager(app, session=app.session)
    app.api_manager.create_api(Members, methods=["GET", "POST", "PATCH", "DELETE"], collection_name="members")

    return app

    @app.route("/shutdown", methods=["POST"])  # pragma: no cover
    def shutdown():  # pragma: no cover
        logging.info("shutting down server")
        return "server shutting down"
Example #2
File: app.py Project: tUn4/boofuzz
from flask import Flask, render_template, redirect
import re

app = Flask(__name__)
app.session = None

def commify(number):
    number = str(number)
    processing = 1
    regex = re.compile(r"^(-?\d+)(\d{3})")
    while processing:
        (number, processing) = regex.subn(r"\1,\2", number)
    return number

def pause():
    # Flip our state
    app.session.is_paused = not app.session.is_paused
    return redirect("/")

def view_crash(crash_id):
    return render_template("view_crash.html", crashinfo=app.session.procmon_results[crash_id])

def index():
    crashes = []