基于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_gridfs-0.3.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 752d1b57a23897ae7fda21d2360816d5d05554dc6c15dda855842111a9ff8d66 |
|
MD5 | c8da5745b7764c1e95034d920358f6f6 |
|
BLAKE2b-256 | 768eb7685d1902b9e400068b3e1ca46bb9f4ac0f148b575f6ad0b9a41add6d87 |