예제 #1
0
def app():
    """An application for the tests."""
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
예제 #2
0
파일: wsgi.py 프로젝트: abirthalia/College
"""

To run a local development server:

    FLASK_TRAP_BAD_REQUEST_ERRORS=1 FLASK_DEBUG=1 FLASK_APP=src/reader/app/wsgi.py \
    READER_DB=db.sqlite flask run -h 0.0.0.0 -p 8000

"""

import os

from reader.app import create_app

app = create_app(os.environ['READER_DB'])
app.config['TRAP_BAD_REQUEST_ERRORS'] = bool(os.environ.get('FLASK_TRAP_BAD_REQUEST_ERRORS', ''))

예제 #3
0
# -*- coding: utf-8 -*-
"""Create an application instance."""
from flask.helpers import get_debug_flag

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

CONFIG = DevConfig if get_debug_flag() else ProdConfig

app = create_app(CONFIG)
예제 #4
0
def test_production_config():
    """Production config."""
    app = create_app(ProdConfig)
    assert app.config['ENV'] == 'prod'
    assert app.config['DEBUG'] is False
    assert app.config['DEBUG_TB_ENABLED'] is False
예제 #5
0
def test_dev_config():
    """Development config."""
    app = create_app(DevConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG'] is True
예제 #6
0
"""

To run a local development server:

    FLASK_DEBUG=1 FLASK_TRAP_BAD_REQUEST_ERRORS=1 \
    FLASK_APP=src/reader/app/wsgi.py \
    READER_DB=db.sqlite flask run -h 0.0.0.0 -p 8000

"""
import os

import reader
from reader.app import create_app

app = create_app(os.environ[reader._DB_ENVVAR],
                 os.environ.get(reader._PLUGIN_ENVVAR, '').split())
app.config['TRAP_BAD_REQUEST_ERRORS'] = bool(
    os.environ.get('FLASK_TRAP_BAD_REQUEST_ERRORS', ''))