Merge remote-tracking branch 'tmuncks/db-handle-disconnects'

This commit is contained in:
Khanh Ngo 2018-06-13 09:00:25 +07:00
commit e763ce7501

View File

@ -1,7 +1,15 @@
from werkzeug.contrib.fixers import ProxyFix
from flask import Flask, request, session, redirect, url_for
from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy
from flask_sqlalchemy import SQLAlchemy as SA
# subclass SQLAlchemy to enable pool_pre_ping
class SQLAlchemy(SA):
def apply_pool_defaults(self, app, options):
SA.apply_pool_defaults(self, app, options)
options["pool_pre_ping"] = True
app = Flask(__name__)
app.config.from_object('config')