Exemplo n.º 1
0
def client():
    test_config = {
        "SQLALCHEMY_DATABASE_URL": "sqlite:///./test-sqlite.db",
        "ENV": "development",
        "DEBUG": True,
        "SECRET_KEY": "would-get-from-env-file"
    }
    app = create_app(test_config)
    with app.test_client() as client:
        yield client

    # remove data in test database
    from project.database import clear_db
    clear_db()
Exemplo n.º 2
0
def app():
    """Create and configure a new app instance for each test."""
    # create a temporary file to isolate the database for each test
    db_fd, db_path = tempfile.mkstemp()
    # create the app with common test config
    app = create_app({
        'TESTING': True,
        'DATABASE': db_path,
    })

    # create the database and load test data
    with app.app_context():
        init_db()
        get_db().executescript(_data_sql)

    yield app

    # close and remove the temporary database
    os.close(db_fd)
    os.unlink(db_path)
Exemplo n.º 3
0
def app():
    app = create_app()
    app.debug = True
    return app.test_client()
Exemplo n.º 4
0
from project.app import create_app
app = create_app()
# -*- coding: utf-8 -*-

from project.app import create_app

application = create_app()

if __name__ == "__main__":
    application.run()
Exemplo n.º 6
0
#!/usr/bin/env python
# coding=utf-8

from project.app import create_app

application = create_app()
Exemplo n.º 7
0
from project.app import create_app

if __name__ == "__main__":
    app = create_app()
    app.run(debug=True)
Exemplo n.º 8
0
"""Create an application instance."""
from flask.helpers import get_debug_flag

from project.app import create_app
from project.settings import DevConfig, ProdConfig

# CONFIG = DevConfig if get_debug_flag() else ProdConfig
CONFIG = DevConfig


app = create_app(CONFIG)
Exemplo n.º 9
0
from project.app import create_app

config = {
    "SQLALCHEMY_DATABASE_URL": "sqlite:///./sqlite.db",
    "ENV": "development",
    "DEBUG": True,
    "SECRET_KEY": "would-get-from-env-file"
}

app = create_app(config)
app.run(debug=True)
Exemplo n.º 10
0
def app():
    from project._config import Config
    config = Config({})
    app = create_app(config)
    return app
Exemplo n.º 11
0
def app():
    test_config = TestingConfig()
    _app = create_app(test_config)
    return _app
Exemplo n.º 12
0
def run():
    return create_app(cli=True,
                      testing=True if sys.argv[1] == 'test' else False)
Exemplo n.º 13
0
import os

from project.app import create_app

app = create_app(os.environ.get("ENV") or "default")

if __name__ == "__main__":
    app.run(debug=True)