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.ext.sqlalchemy import SQLAlchemy | |
from sqlalchemy.interfaces import PoolListener | |
class SQLiteForeignKeysListener(PoolListener): | |
def connect(self, dbapi_con, con_record): | |
db_cursor = dbapi_con.execute('pragma foreign_keys=ON') | |
class StrictSQLAlchemy(SQLAlchemy): |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
from flask import Flask | |
from flaskext.sqlalchemy import SQLAlchemy | |
from werkzeug.security import generate_password_hash | |
from werkzeug.security import check_password_hash | |
from sqlalchemy.orm.exc import NoResultFound | |
app = Flask(__name__) |