예제 #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()
예제 #2
0
파일: conftest.py 프로젝트: kjsu0209/SoGong
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)
예제 #3
0
def app():
    app = create_app()
    app.debug = True
    return app.test_client()
예제 #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()
예제 #6
0
파일: wsgi.py 프로젝트: Richardlihui/ZHIZHI
#!/usr/bin/env python
# coding=utf-8

from project.app import create_app

application = create_app()
예제 #7
0
from project.app import create_app

if __name__ == "__main__":
    app = create_app()
    app.run(debug=True)
예제 #8
0
파일: app.py 프로젝트: jpmayorga/flask-api
"""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)
예제 #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)
예제 #10
0
def app():
    from project._config import Config
    config = Config({})
    app = create_app(config)
    return app
예제 #11
0
def app():
    test_config = TestingConfig()
    _app = create_app(test_config)
    return _app
예제 #12
0
파일: manage.py 프로젝트: alekglez/flask
def run():
    return create_app(cli=True,
                      testing=True if sys.argv[1] == 'test' else False)
예제 #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)