Revisions
-
solarce revised this gist
Dec 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ app.config.from_envvar('FLASKR_SETTINGS', silent=True) def connect_db(): return sqlite3.connect(DATABASE) def init_db(): with closing(connect_db()) as db: -
Blue0ctober created this gist
Dec 12, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #all the imports from __future__ import with_statement from contextlib import closing import sqlite3 from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash # configuration DATABASE = "/tmp/flaskr.db" DEBUG = True SECRET_KEY = 'development key' USERNAME = 'admin' PASSWORD = 'default' # create our little application app = Flask(__name__) app.config.from_envvar('FLASKR_SETTINGS', silent=True) def connect_db(): return sqlite3.connect(app.config['DATABASE']) def init_db(): with closing(connect_db()) as db: with app.open_resource('schema.sql') as f: db.cursor().executescript(f.read()) db.commit() if __name__ == '__main__': app.run()