def create_app_blueprint(config): """ Return the RMIS application instance. :param config (str): the environment for the app (dev, test, prod) :return: Flask app for RMIS """ app = create_app(config, __name__, __path__) return app
def create_app_blueprint(config): print('ceate blueprint function') """ Return the RMIS application instance. :param config (str): the environment for the app (dev, test, prod) :return: Flask app for RMIS """ app = create_app(config, __name__, __path__) # with app.app_context(): # from server.main import db # db.drop_all() # db.create_all() # db.session.commit() return app
from server.main import create_app app = create_app() if __name__ == '__main__': print("Satellite API serving ...") app.run(host="0.0.0.0", port=3550, debug=True)
import os from dotenv import load_dotenv import unittest from flask_praetorian import Praetorian from flask_migrate import Migrate, MigrateCommand from flask_script import Manager from server.main import create_app, db from server.main.model import user from server import blueprint basedir = os.path.abspath(os.path.dirname(__file__)) load_dotenv(os.path.join(basedir, '.env')) app = create_app(os.environ.get('ENV') or 'dev') app.register_blueprint(blueprint) app.app_context().push() manager = Manager(app) migrate = Migrate(app, db) guard = Praetorian() manager.add_command('db', MigrateCommand) guard.init_app(app, user.User) @manager.command def run(): app.run(host='0.0.0.0')