def test_production_config(): """Production.""" 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
"""Management script.""" import os from glob import glob from subprocess import call from flask_migrate import MigrateCommand from flask_script import Command, Manager, Option, Server, Shell from tegenaria.app import create_app from tegenaria.database import db from tegenaria.generic import read_from_keyring from tegenaria.settings import DevConfig, ProdConfig from tegenaria.utils import PROJECT_NAME, calculate_distance, remove_inactive_apartments, reprocess_invalid_apartments if os.environ.get('TEGENARIA_ENV') == 'prod': app = create_app(ProdConfig) else: app = create_app(DevConfig) HERE = os.path.abspath(os.path.dirname(__file__)) TEST_PATH = os.path.join(HERE, 'tests') manager = Manager(app) class Lint(Command): """Lint and check code style with flake8.""" def get_options(self): """Command line options.""" return (Option('-f', '--fix-imports',
# -*- coding: utf-8 -*- """Create an application instance.""" from flask.helpers import get_debug_flag from tegenaria.app import create_app from tegenaria.settings import DevConfig, ProdConfig CONFIG = DevConfig if get_debug_flag() else ProdConfig app = create_app(CONFIG)
def __init__(self): """Constructor.""" config = DevConfig if get_debug_flag() else ProdConfig self.app = current_app or create_app(config) self.app.app_context().push()
def test_dev_config(): """Development.""" app = create_app(DevConfig) assert app.config['ENV'] == 'dev' assert app.config['DEBUG'] is True assert app.config['ASSETS_DEBUG'] is True
def __init__(self): """Constructor.""" self.app = current_app or create_app( DevConfig ) # FIXME: get the right config according to the env variable self.app.app_context().push()