예제 #1
0
def create_app():
    app = Flask(__name__)
    app.config.from_object(envs.get('develop'))
    init_ext(app)
    init_views(app)
    init_api(app)
    return app
예제 #2
0
파일: __init__.py 프로젝트: linanster/aging
def create_app():
    app = Flask(__name__)
    app.config.from_object(config['nan1'])
    init_models(app)
    init_views(app)
    init_apis(app)
    init_ext(app)
    return app
예제 #3
0
def create_app():
    # app = Flask(__name__,
    #             template_folder='../templates')  # Flask实例中可以设置默认模板的寻找路径
    app = Flask(__name__, static_folder='../static')  # 设置static的寻找路径
    app.config.from_object(envs['develop'])  # 注意配置读取的顺序,一定要在配置扩展等东西前面
    init_ext(app)
    init_views(app)
    return app
예제 #4
0
def create_app():
    app = Flask(__name__)
    app.config.from_pyfile(settingfile)
    init_views(app)
    init_apis(app)
    init_models(app)
    init_ext(app)

    return app
예제 #5
0
def create_app():
    app = Flask(__name__)
    app.config.from_pyfile('mysettings.py')
    init_models(app)
    init_views(app)
    init_apis(app)
    init_ext(app)
    load_middleware(app)
    return app
예제 #6
0
def create_app(conf='development'):
    app = Flask(__name__)

    # 加载配置
    app.config.from_object(conf_alias[conf])

    # 加载插件
    init_extensions(app)

    # 加载视图函数
    init_views(app)

    return app
예제 #7
0
def createApp(env_name='default'):

    app = Flask(__name__)

    init_settings(app, env_name)

    init_ext(app)

    init_views(app)

    init_apis(app)

    return app
예제 #8
0
def create_app(env_name='default'):
    from flask import Flask

    app = Flask(__name__)


    init_setting(app,env_name)

    init_exts(app)

    init_views(app)


    return app
예제 #9
0
def create_app(env_name='default'):
    app = Flask(__name__,
                template_folder='../templates',
                static_folder='../static'
                )  #加上template_folder属性才能访问模板文件,static_folder属性访问静态文件

    #配置相关
    init_setting(app, env_name)
    #插件相关
    init_ext(app)
    #蓝图
    init_views(app)
    #api
    init_api(app)

    return app
예제 #10
0
def create_app():
    app = Flask(__name__)
    app.debug = False
    csrf.init_app(app)  # csrf 跨站post保护
    # 必须先执行config再初始化数据库
    app.config.from_pyfile('config')
    db.init_app(app)
    # config[config_name].init_app(app)
    login_manager.init_app(app)
    login_manager.login_view = 'login'
    init_views(app)
    init_api(app)
    bootstrap.init_app(app)
    nav.init_app(app)
    moment.init_app(app)
    mail.init_app(app)
    bcrypt.init_app(app)
    toolbar = DebugToolbarExtension(app)
    return app
예제 #11
0
def create_app(config_name):
    app = MyFlask(__name__, static_folder=None, instance_relative_config=True)
    app.config.from_object("config.{}.Config".format(config_name))

    logging.init_loggers(app)
    models.init_models(app)
    extensions.init_extentions(app)
    views.init_views(app)

    @app.shell_context_processor
    def make_context():
        return dict(app=app)

    app.logger.info("App created")

    # Apply some middlewares
    # If you deploy your application using one of these servers
    # behind an HTTP proxy you will need this.
    # app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_for=1)
    return app
예제 #12
0
def create_app(config='default'):
    '''
    创建flask app,并加载配置,初始化外部插件,views和数据库等
    该函数被manage模块调用
    :param config:选择开发环境,测试环境和线上环境
    :return:flask app
    '''

    # 日志初始化
    init_logging(os.path.join(settings.BASEDIR, "log/log_config.yaml"))

    app = Flask('demo',
                static_folder=settings.STATICPATH,
                template_folder=settings.TEMPLATESPATH)

    app.config.from_object(settings.ENV.get(config))

    init_ext(app)

    init_views(app)

    init_apis_v1(app)

    return app
예제 #13
0
from flask import Flask, render_template, request, redirect, abort
import logging
import os

app = Flask("app", static_folder="static", template_folder="templates")

with app.app_context():
    from app.views import init_views
    init_views(app)

app.run(host="0.0.0.0", port=9000)
예제 #14
0
def create_app():
    app = Flask("app", static_folder="static", template_folder="templates")
    with app.app_context():
        from app.views import init_views
        init_views(app)
        return app
예제 #15
0
파일: app.py 프로젝트: linanster/mysite
def create_app():
    app = Flask(__name__)
    app.config.from_pyfile('mysettings.py')
    init_views(app)
    init_ext(app)
    return app
예제 #16
0
def create_app():
    app = Flask("app", static_folder="static", template_folder="templates")
    with app.app_context():
        from app.views import init_views
        init_views(app)
        return app