Esempio n. 1
0
def db():
    with app.app_context():
        from server.db import db
        db.session.close()
        db.drop_all()
        db.create_all()
        yield db
Esempio n. 2
0
def create_app():

    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///{}".format(
        os.path.join('instance', 'honey.db'))
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
    app.config['SECRET_KEY'] = 'rebornracekey'

    db.init_app(app)
    db.create_all(app=app)

    sio.init_app(app)

    app.register_blueprint(user.bp)
    app.register_blueprint(password.bp)
    app.register_blueprint(registration.bp)


    @app.after_request
    def after_request(response):
        response.headers.add('Access-Control-Allow-Origin', '*')
        response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
        response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
        return response

    return app
def db():
    with app.app_context():
        from server.db import db
        db.session.close()
        db.drop_all()
        db.create_all()
        yield db
Esempio n. 4
0
def init_db():
    '''
        Create tables necessary for this app to work.
    '''
    app = create_app()
    db.init_app(app)
    with app.test_request_context():
        db.create_all()
Esempio n. 5
0
    def setUp(self):
        """
        Creates tables in test database
        """
        with app.app_context():
            db.create_all()

        self.client = app.test_client()
Esempio n. 6
0
def init_db():
    '''
        Create tables necessary for this app to work.
    '''
    app = create_app()
    db.init_app( app )
    with app.test_request_context():
        db.create_all()
Esempio n. 7
0
def create_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
Esempio n. 8
0
def init_db():
    from server import models
    db.create_all()
Esempio n. 9
0
def create_db():
	db.create_all()
Esempio n. 10
0
def create_db():
    db.create_all()