Allow connection string to be overridden by environment variable

Remove NullPool left over from using sqlite
This commit is contained in:
Matthew Welch 2021-07-14 17:07:22 -07:00
parent 4a47c78a1a
commit bd75ecc6ef

View File

@ -13,11 +13,12 @@ from sqlalchemy.dialects.postgresql import BYTEA
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.pool import NullPool
from sqlalchemy.sql.expression import cast
from werkzeug.security import check_password_hash
engine = create_engine("***REMOVED***", poolclass=NullPool)
DB_URL = os.environ.get("CONNECTION_STRING", "***REMOVED***")
engine = create_engine(DB_URL)
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)
session_factory = sessionmaker(bind=engine)
Session = scoped_session(session_factory)