from flask import Flask
import experiments
import db

app = Flask(__name__)

session = db.init_db(drop_all=True)


@app.route('/')
def index():
    return 'Index page'


@app.route('/demo2')
def start():
    experiment = experiments.Demo2(session)
    experiment.add_and_trigger_sources()      # Add any sources
    process = experiment.process  # Step through the process
    for i in xrange(experiment.num_steps):
        process.step()


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

from flask import Flask
import experiments
import db

app = Flask(__name__)

session = db.init_db(drop_all=True)


@app.route('/')
def index():
    return 'Index page'


@app.route('/demo2')
def start():
    experiment = experiments.Demo2(session)
    experiment.add_and_trigger_sources()      # Add any sources
    process = experiment.process  # Step through the process
    for i in xrange(experiment.num_steps):
        process.step()
    return "Demo 2 complete."

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

Return a value when Flask view function completes
Return a value when Flask view function completes
