当前位置: 首页>>代码示例>>Python>>正文


Python flask_uploads.UploadSet方法代码示例

本文整理汇总了Python中flask_uploads.UploadSet方法的典型用法代码示例。如果您正苦于以下问题:Python flask_uploads.UploadSet方法的具体用法?Python flask_uploads.UploadSet怎么用?Python flask_uploads.UploadSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_uploads的用法示例。


在下文中一共展示了flask_uploads.UploadSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_app

# 需要导入模块: import flask_uploads [as 别名]
# 或者: from flask_uploads import UploadSet [as 别名]
def create_app(config_name):

    app = Flask(__name__)

    # Creating the app configurations

    app.config.from_object(config_options[config_name])
    config_options[config_name].init_app(app)

    # Initializing flask extensions
    bootstrap.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    mail.init_app(app)
    simple.init_app(app)


    # Registering the blueprint
    from .main import main as main_blueprint
    app.register_blueprint(main_blueprint)

    from .auth import auth as auth_blueprint
    app.register_blueprint(auth_blueprint,url_prefix = '/auth')

    # setting config
    from .requests import configure_request
    configure_request(app)



    # configure UploadSet
    configure_uploads(app,photos)



    return app 
开发者ID:mbuthiya,项目名称:watchlist,代码行数:38,代码来源:__init__.py

示例2: setup_components

# 需要导入模块: import flask_uploads [as 别名]
# 或者: from flask_uploads import UploadSet [as 别名]
def setup_components(app):
    # bootstrap
    Bootstrap(app)

    # sqlalchemy
    models.db.init_app(app)

    # security
    user_datastore = SQLAlchemyUserDatastore(models.db, models.User,
                                             models.Role)
    security = Security(app, user_datastore)

    # admin
    ModelView.page_size = app.config.get('SLIM_ITEMS_PER_PAGE', 5)
    admin.name = app.config.get('SLIM_APPNAME', 'SLiM')
    admin.init_app(app)

    # define a context processor for merging flask-admin's template context
    # into the flask-security views.
    @security.context_processor
    def security_context_processor():
        return dict(
            admin_base_template=admin.base_template,
            admin_view=admin.index_view,
            h=admin_helpers,
            get_url=url_for
        )

    # nav
    nav.init_app(app)

    # flask-uploads
    # patch_request_class(app, app.config['MAX_CONTENT_LENGTH'])
    request_uploader = UploadSet('requests',
                                 app.config['SLIM_REQUEST_EXTENSIONS'])
    configure_uploads(app, request_uploader)

    # components
    components = dict(
        user_datastore=user_datastore,
        security=security,
        request_uploader=request_uploader,
    )

    return components 
开发者ID:avalentino,项目名称:slim,代码行数:47,代码来源:app.py


注:本文中的flask_uploads.UploadSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。