Exemplo n.º 1
0
 def setUpClass(self):
     """App and DB setup, created with setUpClass for performance reasons"""
     self.app = instantiate_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     self.app = self.app.test_client()
     db.create_all()
Exemplo n.º 2
0
import os

from app import instantiate_app, db
from app.models import Book, Author, Category

app = instantiate_app(os.getenv('FLASK_ENV') or 'development')


@app.cli.command()
def setup_db():
    """Convenience method for adding/modyfing database entries during development"""
    db.create_all()
    db.session.commit()