import os
from flask import Flask, Blueprint
from server.config import configs
from server.extensions import db, mail, ma, migrate, passlib
from server.data.module import load_modules
from server.data.research import load_research


# Blueprints
user_bp = Blueprint('user', __name__)
admin_bp = Blueprint('admin', __name__)


def create_app(config='develop'):

    app = Flask(
        __name__,
        static_folder='../static',
        static_url_path='/static-native',
    )
    config = configs[config]
    app.config.from_object(config)
    db.init_app(app)
    ma.init_app(app)
    migrate.init_app(app, db)
    mail.init_app(app)
    passlib.init_app(app)

    from server.handlers import register_handlers
    register_handlers(app)

    register_blueprints(app)

    module_data = load_modules(getattr(config(), "MODULE_FILE_PATH"))
    research_data = load_research(getattr(config(), "RESEARCH_FILE_PATH"))

    return app


def register_blueprints(app):
    app.register_blueprint(user_bp)
    app.register_blueprint(admin_bp, url_prefix='/admin')


def run():
    config = os.getenv('SQLALCHEMY_DATABASE_URI', 'develop')
    app = create_app(config)
    app.run(host="0.0.0.0")


import server.api
import server.models

@@ -38,16 +38,17 @@
 ueprint%0A
+%0A
 from ser
@@ -89,56 +89,24 @@
 ver.
-extensions import db, mail, ma, migrate, passlib
+data import data
 %0Afro
@@ -193,16 +193,77 @@
 esearch%0A
+from server.extensions import db, mail, ma, migrate, passlib%0A
 %0A%0A# Blue
@@ -800,16 +800,21 @@
 p)%0A%0A    
+data.
 module_d
@@ -875,16 +875,21 @@
 %22))%0A    
+data.
 research

Fix module research loading