當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。