示例#1
1
文件: __init__.py 项目: rlanger/Rondo
def create_app(config=None):
    """Create an instance of the tentd flask application"""
    app = Flask("tentd")
    app.add_url_rule("/", "home", description)
    app.request_class = Request

    # Load the default configuration values
    import tentd.defaults as defaults

    app.config.from_object(defaults)

    # Load the user configuration values
    if isinstance(config, basestring):
        config = make_config(config)

    if not isinstance(config, dict):
        raise TypeError("Config argument must be a dict or string.")

    if config is not None:
        app.config.update(config)

    # Initialise the db for this app
    db.init_app(app)

    # Register the entity blueprints
    for blueprint in (entity, followers, posts):
        app.register_blueprint(blueprint, url_prefix=blueprint.prefix(app))

    return app
示例#2
0
def create_app(config=None):
    """Create an instance of the tentd flask application"""
    app = Flask('tentd')
    app.add_url_rule('/', 'home', description)
    app.request_class = Request
    
    # Load the default configuration values
    import tentd.defaults as defaults
    app.config.from_object(defaults)

    # Load the user configuration values
    if isinstance(config, basestring):
        config = make_config(config)

    if not isinstance(config, dict):
        raise TypeError("Config argument must be a dict or string.")
        
    if config is not None:
        app.config.update(config)

    # Initialise the db for this app
    db.init_app(app)

    # Register the entity blueprints
    for blueprint in (entity, followers, posts):
        app.register_blueprint(blueprint, url_prefix=blueprint.prefix(app))

    return app
示例#3
0
def create_app(config=dict()):
    """Create an instance of the tentd flask application"""
    app = Flask('tentd')
    app.add_url_rule('/', 'home', description)
    
    # Load configuration
    import tentd.defaults as defaults
    app.config.from_object(defaults)
    app.config.update(config)

    # Initialise the db for this app
    db.init_app(app)

    # Register the blueprints
    app.register_blueprint(entity)

    return app
示例#4
0
def create_app(config=dict()):
    """Create an instance of the tentd flask application"""
    app = Flask('tentd')
    app.add_url_rule('/', 'home', description)

    # Load configuration
    import tentd.defaults as defaults
    app.config.from_object(defaults)
    app.config.update(config)

    # Initialise the db for this app
    db.init_app(app)

    # Register the blueprints
    app.register_blueprint(entity)

    return app