Decoupled db from app init

This commit is contained in:
Maxim Stewart 2019-12-29 15:59:11 -06:00
parent b3a4e6a95f
commit c22255b2e5
2 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,7 @@ app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///static/db/database.db" app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///static/db/database.db"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app) from core.models import db
db.init_app(app)
from core import routes from core import routes

View File

@ -1,4 +1,6 @@
from core import db from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Table(db.Model): class Table(db.Model):