예제 #1
0
def create_app(ConfigName):
    app = Flask(__name__)
    # 加载网站配置,config.py文件
    app.config.from_object(config[ConfigName])
    # 加载所有第三方扩展库
    ext_int(app)
    # 注册蓝本
    register_blueprint(app)

    return app
예제 #2
0
파일: __init__.py 프로젝트: lswshiwei/flask
def creat_app(config_name):
    app = Flask(__name__)
    # 初始化配置
    if config_name not in config:
        config_name = 'develop'
    app.config.from_object(config[config_name])
    # 初始化函数调用
    init_extension(app)
    # 注册蓝图
    register_blueprint(app)
    return app
예제 #3
0
def create_app(config_name):
    # 创建用于实例
    app = Flask(__name__)
    # 初始化配置
    app.config.from_object(config.get(config_name, 'default'))
    # 配置扩展
    config_extensions(app)
    # 注册蓝本
    register_blueprint(app)
    # 返回应用实例
    return app
예제 #4
0
def create_app(config_name=None):
    # 创建实例
    app = Flask(__name__)
    # 初始化配置
    if config_name not in config:
        config_name = 'default'
    app.config.from_object(config[config_name])
    # 初始化扩展
    init_extensions(app)
    # 注册蓝本
    register_blueprint(app)
    return app
예제 #5
0
def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config.get(config_name or 'default'))
    config_extensions(app)
    register_blueprint(app)
    return app