Skip to content

Instantly share code, notes, and snippets.

@marknagelberg
Created October 14, 2018 00:26
Show Gist options
  • Save marknagelberg/f4cb543ca596d383362ef9383b03ee6a to your computer and use it in GitHub Desktop.
Save marknagelberg/f4cb543ca596d383362ef9383b03ee6a to your computer and use it in GitHub Desktop.
app.py revised to be more interesting for system tests
from flask import Flask, render_template, Blueprint
from .forms import NameForm
from .models import Name
from . import db
bp = Blueprint('app', __name__)
@bp.route('/', methods=['GET', 'POST'])
def home():
form = NameForm()
if form.validate_on_submit():
db.session.add(Name(name=form.name.data))
db.session.commit()
names = Name.query.all()
return render_template('index.html', form=form, names=names)
names = Name.query.all()
return render_template('index.html', form=form, names=names)
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment