예제 #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()
예제 #2
0
파일: main.py 프로젝트: Kehashi91/books
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()