Esempio n. 1
0
def app():
    """Fixture to provide the application object and initialize the
    database."""
    sandman_app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + DB_LOCATION
    shutil.copy(os.path.join(os.getcwd(), 'tests', 'data', 'chinook.sqlite3'),
                DB_LOCATION)
    sandman_app.testing = True
    db.init_app(sandman_app)
    try:
        reflect_all()
    except AssertionError:
        pass

    yield sandman_app

    os.unlink(DB_LOCATION)
Esempio n. 2
0
def app():
    """Fixture to provide the application object and initialize the
    database."""
    sandman_app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + DB_LOCATION
    shutil.copy(
        os.path.join(
            os.getcwd(),
            'tests',
            'data',
            'chinook.sqlite3'),
        DB_LOCATION)
    sandman_app.testing = True
    db.init_app(sandman_app)
    try:
        reflect_all()
    except AssertionError:
        pass

    yield sandman_app

    os.unlink(DB_LOCATION)
Esempio n. 3
0
"""Run server"""
from sqlalchemy.ext.automap import automap_base
from sandman import app, reflect_all
from sandman.models import db
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite+pysqlite:///existing.sqlite3'
app.secret_key = 's3cr3t'
db.init_app(app)
reflect_all()
app.run(host='0.0.0.0', debug=True)