Ejemplo n.º 1
0
def syncdb():
    """Synchronize the models with the database."""
    app = Application()
    with app.app_context():
        db.drop_all()
        db.create_all()
Ejemplo n.º 2
0
 def create_app(cls):
     return Application('test')
Ejemplo n.º 3
0
def pytest_configure(config):
    app = Application('test')
    with app.app_context():
        db.create_all()
Ejemplo n.º 4
0
def pytest_unconfigure(config):
    app = Application('test')
    with app.app_context():
        db.drop_all()
Ejemplo n.º 5
0
def syncdb():
    """Synchronize the models with the database."""
    app = Application()
    with app.app_context():
        db.drop_all()
        db.create_all()
Ejemplo n.º 6
0
#!/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():