These are chat archives for pythonvietnam/Flask

25th
Feb 2018
Luna
@LunaBlitz
Feb 25 23:10
Hello, I'm trying to get flask to talk to a data base but I'm not sure where to start.
This is what I have so far.

from flask import *
from flask_sqlalchemy import SQLALchemy

app = Flask(name)
db = SQLALCHEMY(app)
app.config['SQLALCHEMY_DATABASE_URI'] = ''

@app.route('/home')
def home():
return render_template("feedback_homepage.html")

@app.route('/feedback')
def feedback():
return render_template("feedback_form.html")

@app.route('/feedback', methods=['POST'])
def adviceinfo():
if request.method == 'POST':
firstname = request.form['firstname']
email = request.form['email']
comments = request.form['comments']
return redirect(url_for('reviews'))

@app.route('/feedback', methods='GET')
def retrieve():
if request.method == 'GET':
firstname = request.form['firstname']
email = request.form['email']
comments = request.form['comments']
return

@app.route('/reviews')
def reviews():
return render_template("reviewpage.html")

if name == "main":
app.run(debug=True)