Skip to content

Instantly share code, notes, and snippets.

@marknagelberg
Created August 20, 2018 04:44
Show Gist options
  • Save marknagelberg/a59dc1feb241dd02687be6b97d06fc1e to your computer and use it in GitHub Desktop.
Save marknagelberg/a59dc1feb241dd02687be6b97d06fc1e to your computer and use it in GitHub Desktop.
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()
return render_template('index.html', form=form)
return render_template('index.html', form=form)
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