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)
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
def app(): """An application for the tests.""" _app = create_app(TestConfig) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
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
def create_myapp(info): return create_app(cli=True)
from myapp.app import create_app app = create_app()
# manage.py from myapp.app import create_app from flask_appfactory import load_cli app = create_app() load_cli(app)
# -*- 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)
def app(): assert os.getenv( "ENV") == "TEST", "You must run tests in TEST environment only" app = create_app() return app
from myapp.app import create_app from myapp.extensions import celery as worker flask_app = create_app() celery_app = worker
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"]))
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