Beispiel #1
0
 def setUp(self):
     self.app_config = create_app(Config)
     self.app_test = create_app(TestConfig)
     self.app_dev = create_app(DevConfig)
     self.app_prod = create_app(ProdConfig)
     self.client = self.app_test.test_client()
     db.create_all(app=self.app_test)
Beispiel #2
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
    assert app.config['ASSETS_DEBUG'] is False
Beispiel #3
0
def app():
    """An application for the tests."""
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Beispiel #4
0
def app():
    params = {
        'DEBUG': False,
        'TESTING': True,
    }
    _app = create_app(settings_override=params)
    ctx = _app.app_context()
    ctx.push()

    yield _app

    ctx.pop()
def app():
    app = create_app(testing=True)
    return app
Beispiel #6
0
def create_myapp(info):
    return create_app(cli=True)
from myapp.app import create_app

app = create_app()
Beispiel #8
0
# manage.py
from myapp.app import create_app
from flask_appfactory import load_cli
app = create_app()
load_cli(app)
Beispiel #9
0
# -*- coding: utf-8 -*-
"""Create an application instance."""
from flask.helpers import get_debug_flag

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

CONFIG = DevConfig if get_debug_flag() else ProdConfig

app = create_app(CONFIG)
 def setUp(self):
     self.app = create_app(Config)
     db.create_all(app=self.app)
     self.client = self.app.test_client()
     db.create_all(app=self.app)
def app(loop, conf):
    return create_app(loop, conf=conf)
Beispiel #12
0
def app():
    assert os.getenv(
        "ENV") == "TEST", "You must run tests in TEST environment only"
    app = create_app()
    return app
Beispiel #13
0
from myapp.app import create_app
from myapp.extensions import celery as worker

flask_app = create_app()

celery_app = worker
Beispiel #14
0
import os
import yaml
import pandas as pd
import numpy as np

from flask_script import Manager
from sqlalchemy_utils import database_exists, create_database

from myapp import blueprint
from myapp import utils
from myapp.model import address
from myapp.app import create_app, database

app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')
app.register_blueprint(blueprint)
app.app_context().push()

manager = Manager(app)

@app.after_request
def set_response_headers(response):
    response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
    response.headers['Pragma'] = 'no-cache'
    response.headers['Expires'] = '0'
    return response

@manager.command
def run():
    app.run(app.config["APP_HOST"], port=int(app.config["APP_PORT"]))

Beispiel #15
0
def test_dev_config():
    """Development config."""
    app = create_app(DevConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG'] is True
    assert app.config['ASSETS_DEBUG'] is True