def setUp(self): app = create_app('config.TestConfig') self.app = JWTManager(app) with app.test_request_context(): self.access_token = create_access_token('test') self.client = app.test_client() db.app = app db.create_all() db.session.query(Book).delete() db.session.query(Office).delete() db.session.commit()
from web_app import app from web_app import db if __name__ == '__main__': db.create_all() app.secret_key = '123456' app.run(debug=True, host='0.0.0.0', port=8083, threaded=True)
def create_db(): db.create_all() db.session.commit() print(db.engine.table_names())
from web_app import db, create_app db.create_all(app=create_app())
import sqlite3 from web_app import app from flask import g from flask_sqlalchemy import SQLAlchemy from web_app import db db.create_all()
def setUp(self): db.create_all() # Setup the testing database schema
def setUp(self): app = create_app('config.TestConfig') self.app = JWTManager(app) self.client = app.test_client() db.app = app db.create_all()