from flask import Flask
from App import settings

#创建app
from App.views import init_blueprint
from .ext import init_ext


def create_app():
    develop = settings.configs.get('develop')
    app = Flask(
        __name__,
        static_folder=develop.STATIC_FOLDER,
        template_folder=develop.TEMPLATE_FOLDER
    )

    #加载配置文件
    app.config.from_object(develop)

    #加载扩展库
    init_ext(app)

    #注册蓝图
    init_blueprint(app)

    return app
