Flaskr ~~~~~~ A microblog example application written as Flask tutorial with Flask and sqlite3. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os from db import User, Alticle,Dboj from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash # create our little application :) app = Dboj.getapp() app.config.from_envvar('FLASKR_SETTINGS', silent=True) app.secret_key = 'why would I tell you my secret key?' #res= User.query.with_entities(User.password).all() #print res @app.route('/') def show_entries(): #db = get_db() #cur = db.execute('select title, text from entries order by id desc') #entries = cur.fetchall() entries=Alticle.query.with_entities(Alticle.title,Alticle.text).all() return render_template('show_entries.html', entries=entries)
Flaskr ~~~~~~ A microblog example application written as Flask tutorial with Flask and sqlite3. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os from db import User, Alticle, Dboj from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash # create our little application :) app = Dboj.getapp() app.config.from_envvar('FLASKR_SETTINGS', silent=True) app.secret_key = 'why would I tell you my secret key?' #res= User.query.with_entities(User.password).all() #print res @app.route('/') def show_entries(): #db = get_db() #cur = db.execute('select title, text from entries order by id desc') #entries = cur.fetchall() entries = Alticle.query.with_entities(Alticle.title, Alticle.text).all() return render_template('show_entries.html', entries=entries)