def create_app(self): app = Flask(config.APP_NAME) app = create_app(app) app.config["TESTING"] = True if app.config.get('TEST_DB_URI') is None: raise TestCaseDBException("No TEST_DB_URI specified in config.py!") app.config['SQLALCHEMY_DATABASE_URI'] = app.config.get('TEST_DB_URI') self.migration = Migration(app) return app
import click from flask import Flask import config from lib.app import create_app from plugins.db import db from lib.utils import blueprint_template from lib.migration import Migration app = create_app(Flask(config.APP_NAME)) @click.group() def manage(): pass @click.command() def test(): """Run tests""" import unittest suite = unittest.TestLoader()\ .discover("tests", pattern="*_test.py") unittest.TextTestRunner(verbosity=config.TEST_VERBOSITY).run(suite) manage.add_command(test) @click.group("migration", options_metavar="\b") def migration(): """Database migration""" pass
from flask import Flask from lib.app import create_app if __name__ == "__main__": app = Flask(__name__) app = create_app(app) app.run()