From 2cec3498fe6505596c8a8a020544c083a2cb2b13 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 25 Aug 2020 13:14:30 -0700 Subject: [PATCH] fix circular imports --- wowstash/factory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wowstash/factory.py b/wowstash/factory.py index 8f84995..8528b35 100644 --- a/wowstash/factory.py +++ b/wowstash/factory.py @@ -1,12 +1,8 @@ -import wowstash.models from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_session import Session from flask_bcrypt import Bcrypt from redis import Redis -from wowstash.blueprints.authentication import authentication_bp -from wowstash.blueprints.account import account_bp -from wowstash.blueprints.meta import meta_bp from wowstash import config @@ -25,6 +21,7 @@ def _setup_db(app: Flask): app.config['SQLALCHEMY_DATABASE_URI'] = uri app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) + import wowstash.models db.create_all() def _setup_session(app: Flask): @@ -37,12 +34,12 @@ def _setup_session(app: Flask): Session(app) def _setup_bcrypt(app: Flask): + global bcrypt bcrypt = Bcrypt(app) def create_app(): global app global db - app = Flask(__name__) app.config.from_envvar('FLASK_SECRETS') app.secret_key = app.config['SECRET_KEY'] @@ -53,6 +50,9 @@ def create_app(): _setup_bcrypt(app) # Routes + from wowstash.blueprints.authentication import authentication_bp + from wowstash.blueprints.account import account_bp + from wowstash.blueprints.meta import meta_bp app.register_blueprint(meta_bp) app.register_blueprint(authentication_bp) app.register_blueprint(account_bp)