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


Python DepotManager.make_middleware方法代码示例

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


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

示例1: test_invalid_mountpoint

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
 def test_invalid_mountpoint(self):
     try:
         DepotManager.make_middleware(self.wsgi_app, mountpoint='hello')
     except ValueError as err:
         assert 'mountpoint must be an absolute path' in str(err)
     else:
         assert False, 'Should have raised ValueError'
开发者ID:amol-,项目名称:depot,代码行数:9,代码来源:test_wsgi_middleware.py

示例2: setup

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
def setup():
    setup_database()

    DepotManager._clear()
    DepotManager.configure('default', {'depot.storage_path': './lfs'})
    DepotManager.configure('another', {'depot.storage_path': './lfs'})
    DepotManager.alias('another_alias', 'another')
    DepotManager.make_middleware(None)
开发者ID:chatid,项目名称:depot,代码行数:10,代码来源:test_fields_sqlalchemy.py

示例3: make_app

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
def make_app(global_conf, full_stack=True, **app_conf):
    """
    Set depotexample up with the settings found in the PasteDeploy configuration
    file used.
    
    :param global_conf: The global settings for depotexample (those
        defined under the ``[DEFAULT]`` section).
    :type global_conf: dict
    :param full_stack: Should the whole TG2 stack be set up?
    :type full_stack: str or bool
    :return: The depotexample application with all the relevant middleware
        loaded.
    
    This is the PasteDeploy factory for the depotexample application.
    
    ``app_conf`` contains all the application-specific settings (those defined
    under ``[app:main]``.
    
   
    """
    app = make_base_app(global_conf, full_stack=True, **app_conf)
    
    # Wrap your base TurboGears 2 application with custom middleware here
    from depot.manager import DepotManager
    app = DepotManager.make_middleware(app)

    return app
开发者ID:adamchainz,项目名称:depot,代码行数:29,代码来源:middleware.py

示例4: make_app

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
 def make_app(self, **options):
     wsgi_app = DepotManager.make_middleware(self.wsgi_app, **options)
     return TestApp(wsgi_app)
开发者ID:dirn,项目名称:depot,代码行数:5,代码来源:test_wsgi_middleware.py

示例5: get_wsgi_application

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
"""
WSGI config for depotexample project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "depotexample.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Configure a "default" storage based on DEPOT settings
from django.conf import settings
from depot.manager import DepotManager
DepotManager.configure('default', settings.DEPOT, prefix='')

# Wrap the application with depot middleware to serve files on /depot
application = DepotManager.make_middleware(application)
开发者ID:amol-,项目名称:depot,代码行数:24,代码来源:wsgi.py

示例6: test_prevent_multiple_middlewares

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
 def test_prevent_multiple_middlewares(self):
     DepotManager.make_middleware(None)
     DepotManager.make_middleware(None)
开发者ID:adamchainz,项目名称:depot,代码行数:5,代码来源:test_depot_manager.py

示例7: Flask

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import make_middleware [as 别名]
from flask import Flask, request, redirect, url_for, render_template

app = Flask(__name__)

# This is just an horrible way to keep around
# uploaded files, but in the end we just wanted
# to showcase how to setup DEPOT, not how to upload files.
UPLOADED_FILES = []


@app.route("/", methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        file = request.files['file']
        if file:
            fileid = DepotManager.get().create(file)
            UPLOADED_FILES.append(fileid)
            return redirect(url_for('index'))

    files = [DepotManager.get().get(fileid) for fileid in UPLOADED_FILES]
    return render_template('index.html', files=files)


from depot.manager import DepotManager
DepotManager.configure('default', {'depot.storage_path': '/tmp/'})
app.wsgi_app = DepotManager.make_middleware(app.wsgi_app)

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5001, debug=True)
开发者ID:adamchainz,项目名称:depot,代码行数:31,代码来源:app.py


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