示例#1
0
def configure_app(app):
    """
    setup the flask application using setting directives.

    there are 3 ways to properly configure the flask app:

    * changing ``settings.py`` content
    * using the environmental variable ``MIDDLEWARE_SETTINGS``
    * using a custom python file ``settings_local.cfg``

    """
    if DEV:
        setup = settings.DevelopmentConfig
    else:
        setup = settings.ProductionConfig

    app.config.from_object(setup)
    app.config.from_envvar('MIDDLEWARE_SETTINGS', silent=True)
    # cloud configuration
    app.config.from_object(settings.CloudConfig)
    app.config['POOL'] = cloud_init.prepare_cloud_environment(
                                                    app.config['CLOUD_FARM'])
    # parent directory
    here = os.path.dirname(os.path.abspath( __file__ ))
    config_path = os.path.join(os.path.dirname(here), 'settings_local.cfg')
    if os.path.exists(config_path):
        app.config.from_pyfile(config_path)
示例#2
0
	def setUp(self):
		self.driver_setting =  {'fake_driver': {'ENGINE': Provider.DUMMY } }
		self.cloud_pool = prepare_cloud_environment(self.driver_setting)