def syncdb(): """Synchronize the models with the database.""" app = Application() with app.app_context(): db.drop_all() db.create_all()
def create_app(cls): return Application('test')
def pytest_configure(config): app = Application('test') with app.app_context(): db.create_all()
def pytest_unconfigure(config): app = Application('test') with app.app_context(): db.drop_all()
#!/usr/bin/env python import base64 import os from flask.ext.script import Manager, Server from MonkeyBook import Application, models from MonkeyBook.extensions import db app = Application() manager = Manager(app) manager.add_command('runserver', Server(host='localhost')) @manager.shell def make_shell_context(): context = {} context['app'] = app context['db'] = db for model in dir(models): if model[0].isupper(): context[model] = getattr(models, model) return context @manager.command def syncdb(): """Synchronize the models with the database.""" app = Application() with app.app_context():