Exemplo n.º 1
0
def app():
    """ creates a flask instance """
    _app = create_app(config=TestConfig)
    ctx = _app.test_request_context()
    ctx.push()
    yield _app
    ctx.pop()
Exemplo n.º 2
0
def app():
    """ creates a flask instance """
    _app = create_app(config=TestConfig)
    ctx = _app.test_request_context()
    ctx.push()
    yield _app
    ctx.pop()
Exemplo n.º 3
0
def app(db_config):
    """
    Create a flask app test fixture

    :param tmp_file: pytest fixture
    """
    config = build_single_use_config(db_config=db_config)
    _app = create_app(config=config)

    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Exemplo n.º 4
0
def app(db_config):
    """
    Create a flask app test fixture

    :param db_config: database config object
    """
    config = build_single_use_config(db_config=db_config)
    _app = create_app(config=config)

    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Exemplo n.º 5
0
# coding=utf-8
"""Starts the mycodo flask UI."""
import argparse
import sys
import os

sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))

from mycodo.config import ENABLE_FLASK_PROFILER
from mycodo.mycodo_flask.app import create_app

app = create_app()  # required by the wsgi config and main()

# Flask profiler
if ENABLE_FLASK_PROFILER:
    import flask_profiler
    flask_profiler.init_app(app)

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description="Mycodo Flask HTTP server.")

    options = parser.add_argument_group('Options')
    options.add_argument('-d',
                         '--debug',
                         action='store_true',
                         help="Run Flask with debug=True (Default: False)")
    options.add_argument('-s',
                         '--ssl',
                         action='store_true',
                         help="Run Flask without SSL (Default: Enabled)")
Exemplo n.º 6
0
# coding=utf-8
""" Starts the mycodo flask UI """
import argparse
import sys
import os

sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))

from mycodo.mycodo_flask.app import create_app

app = create_app()  # required by the wsgi config and main()


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description="Mycodo Flask HTTP server.",
                                     formatter_class=argparse.RawTextHelpFormatter)

    options = parser.add_argument_group('Options')
    options.add_argument('-d', '--debug', action='store_true',
                         help="Run Flask with debug=True (Default: False)")
    options.add_argument('-s', '--ssl', action='store_true',
                         help="Run Flask without SSL (Default: Enabled)")

    args = parser.parse_args()

    debug = args.debug

    if args.ssl:
        app.run(host='0.0.0.0', port=80, debug=debug)
    else: