跳转到主要内容

基于Pyramid Web框架的MongoDB到Web网关

项目描述

zopyx_gridfs

这是一个基于Pyramid Web框架的小型GridFS (MongoDB) 到Web网关。

安装

  • 需要Python 2.6

  • 使用virtualenv创建虚拟环境

  • 在虚拟环境内部

    bin/easy_install zopyx_gridfs
  • 创建一个包含以下内容的 server.ini 配置文件

    [app:zopyx_gridfs]
    use = egg:zopyx_gridfs
    reload_templates = true
    debug_authorization = false
    debug_notfound = false
    debug_routematch = false
    debug_templates = true
    default_locale_name = en
    # MongoDB specific configurations
    mongo_host = localhost
    mongo_port = 27017
    database = test
    
    [pipeline:main]
    pipeline =
        egg:WebError#evalerror
        zopyx_gridfs
    
    [server:main]
    use = egg:Paste#http
    host = 0.0.0.0
    port = 6543
    
    # Begin logging configuration
    
    [loggers]
    keys = root
    
    [handlers]
    keys = console
    
    [formatters]
    keys = generic
    
    [logger_root]
    level = INFO
    handlers = console
    
    [handler_console]
    class = StreamHandler
    args = (sys.stderr,)
    level = NOTSET
    formatter = generic
    
    [formatter_generic]
    format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
  • 使用以下命令启动GridFS服务器(这将启动一个运行在localhost:6543上的HTTP服务器)

    bin/paster serve server.ini

用法

下载文件

您可以通过HTTP访问存储在GridFS内的文件

http://localhost:6543/<collection>/<filename>

其中 collection 指的是GridFS使用的集合,而 filename 是用于在GridFS中存储文件的 _id

如果请求的文件找不到,服务器将返回404响应。

上传文件

要将文件上传到集合,您需要使用内置的上传表单

http://localhost:6543/<collection>/upload_form

作者

ZOPYX Limited
c/o Andreas Jung
Charlottenstr. 37/1
D-72070 Tuebingen, Germany
www.zopyx.com

0.3.0

  • 添加了上传支持

0.2.2

  • 使用Pyramid的正确路由机制

0.2.0

  • 改为遍历而不是使用URL参数

0.1.2

  • 更好的头部处理

0.1.0

  • 初始版本

项目详情


下载文件

下载适用于您平台的文件。如果您不确定该选择哪个,请了解更多关于安装包的信息。

源代码分发

zopyx_gridfs-0.3.0.tar.gz (14.8 kB 查看哈希值)

上传时间 源代码

支持者