Created
October 14, 2018 00:26
-
-
Save marknagelberg/f4cb543ca596d383362ef9383b03ee6a to your computer and use it in GitHub Desktop.
app.py revised to be more interesting for system tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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