Example #1
0
def create_app(settings=None):
    """
    Creates a flask application.

    @param settings: Settings override object.
    @return: The flask application.
    """
    app = Flask(__name__)

    if settings:
        app.config.from_object(settings)
    else:
        args = _generate_args()
        profile = args.pop('profile')
        app.config['DEBUG'] = args.pop('debug')
        config_file = _load_config_file()
        database_uri = _load_database()
        _config_from_config_profile(config_file, profile, app)
        app.config['SQLALCHEMY_DATABASE_URI'] = database_uri

    DB.init_app(app)

    default_controller = __import__('ec2stack.controllers.' + 'default', None,
                                    None, 'DEFAULT')
    default_controller = getattr(default_controller, 'DEFAULT')
    app.register_blueprint(default_controller)

    return app
Example #2
0
def create_app(settings=None):
    """
    Creates a flask application.

    @param settings: Settings override object.
    @return: The flask application.
    """
    app = Flask(__name__)

    if settings:
        app.config.from_object(settings)
    else:
        config_file = _load_config_file()
        app.config.from_pyfile(config_file)
        database_uri = _load_database()
        app.config['SQLALCHEMY_DATABASE_URI'] = database_uri

    _valid_config_file(app)
    DB.init_app(app)

    default_controller = __import__(
        'ec2stack.controllers.' + 'default', None, None, 'DEFAULT'
    )
    default_controller = getattr(default_controller, 'DEFAULT')
    app.register_blueprint(default_controller)

    return app
def create_app(settings=None):
    """
    Creates a flask application.

    @param settings: Settings override object.
    @return: The flask application.
    """
    app = Flask(__name__)

    if settings:
        app.config.from_object(settings)
    else:
        args = _generate_args()
        profile = args.pop('profile')
        app.config['DEBUG'] = args.pop('debug')
        config_file = _load_config_file()
        database_uri = _load_database()
        _config_from_config_profile(config_file, profile, app)
        app.config['SQLALCHEMY_DATABASE_URI'] = database_uri

    DB.init_app(app)

    default_controller = __import__(
        'ec2stack.controllers.' + 'default', None, None, 'DEFAULT'
    )
    default_controller = getattr(default_controller, 'DEFAULT')
    app.register_blueprint(default_controller)

    return app
 def setUp(self):
     super(Ec2StackAppTestCase, self).setUp()
     self.app = self._create_app()
     self.client = self.app.test_client()
     self.app_context = self.app.app_context()
     self.app_context.push()
     DB.create_all()
     self._create_fixtures()
Example #5
0
 def setUp(self):
     super(Ec2StackAppTestCase, self).setUp()
     self.app = self._create_app()
     self.client = self.app.test_client()
     self.app_context = self.app.app_context()
     self.app_context.push()
     DB.create_all()
     self._create_fixtures()
Example #6
0
class User(DB.Model):
    __tablename__ = 'users'
    apikey = DB.Column(DB.String(255), primary_key=True)
    secretkey = DB.Column(DB.String(255), unique=True)

    def __init__(self, apikey, secretkey):
        self.apikey = apikey
        self.secretkey = secretkey
Example #7
0
class User(DB.Model):
    __tablename__ = 'users'
    apikey = DB.Column(DB.String(255), primary_key=True)
    secretkey = DB.Column(DB.String(255), unique=True)

    def __init__(self, apikey, secretkey):
        """
        Create's a new user.

        @param apikey: apikey associated with the user.
        @param secretkey: secret key associated with the user.
        """
        self.apikey = apikey
        self.secretkey = secretkey
 def tearDown(self):
     super(Ec2StackAppTestCase, self).tearDown()
     DB.drop_all()
     self.app_context.pop()
Example #9
0
 def tearDown(self):
     super(Ec2StackAppTestCase, self).tearDown()
     DB.drop_all()
     self.app_context.pop()