diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/Dawn/__init__.py | 6 | ||||
| -rw-r--r-- | python/Dawn/models.py | 3 | ||||
| -rw-r--r-- | python/Dawn/views.py | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/python/Dawn/__init__.py b/python/Dawn/__init__.py index 1029d764..a88b0301 100644 --- a/python/Dawn/__init__.py +++ b/python/Dawn/__init__.py @@ -1,10 +1,12 @@ from flask import Flask import logging +from flask_sqlalchemy import SQLAlchemy +from sqlalchemy import MetaData app = Flask(__name__) app.config.from_envvar('CONF') -from Dawn.models import db -db.init_app(app) +db = SQLAlchemy(app, metadata = MetaData(schema=app.config['SCHEMA'])) + if not app.debug: fh = logging.FileHandler(filename=app.config['LOGFILE']) fh.setLevel(logging.INFO) diff --git a/python/Dawn/models.py b/python/Dawn/models.py index 1f2da77a..5bde4974 100644 --- a/python/Dawn/models.py +++ b/python/Dawn/models.py @@ -1,4 +1,3 @@ -from flask_sqlalchemy import SQLAlchemy from flask_wtf import Form from flask_wtf.file import FileField from sqlalchemy.dialects.postgresql import ENUM @@ -7,7 +6,7 @@ from wtforms.validators import Length from wtforms_alchemy import model_form_factory from sqlalchemy_utils import EmailType, PhoneNumberType -db = SQLAlchemy() +from . import db class Counterparties(db.Model): __tablename__ = 'counterparties' diff --git a/python/Dawn/views.py b/python/Dawn/views.py index d56c8551..f6078735 100644 --- a/python/Dawn/views.py +++ b/python/Dawn/views.py @@ -12,7 +12,7 @@ import redis from .utils import load_counterparties, bump_rev, simple_serialize from PyPDF2 import PdfFileMerger from io import BytesIO -from Dawn import app +from . import app import socket import psycopg2 |
