为CouchDB设置Python ViewServer [英] Setting up a Python ViewServer for CouchDB

查看:106
本文介绍了为CouchDB设置Python ViewServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力跟上CouchDB的发展。作为使用Python的相对较新的用户,我正在尝试设置一个视图服务器,以便可以将python函数传递给ouchdb.design.ViewDefinitions函数。据我了解,ViewDefinitions采用javascript代码来执行map / reduce功能。

I am trying to get up to speed with CouchDB. As a relatively new user on Python, I am trying to set up a view-server so that I can pass on python functions to couchdb.design.ViewDefinitions function. As I understand, ViewDefinitions take javascript code to execute map/reduce function.

这是我很难理解的-我很清楚这可能是一个基本问题。根据Wiki( http://wiki.apache.org/couchdb/View_server ):

Here is what I struggle to understand - I am well aware that this might be a basic question. According to wiki (http://wiki.apache.org/couchdb/View_server):

要向CouchDB注册查询服务器,请在local.ini中为每台服务器添加一行。基本语法为:
‘[query_servers] python = / usr / bin / couchpy’

To register query servers with CouchDB, add a line for each server to local.ini. The basic syntax is: '[query_servers] python=/usr/bin/couchpy'

如何访问local.ini文件?我是10.6.8 Mac用户。谢谢!

How do I access local.ini file? I am an 10.6.8 Mac user. Thanks!

更新:谢谢Kxepal。看来我能够用Python在Futon上创建设计/视图。另外,我认为可以如下创建python viewserver:
curl -X PUT http:// [localhost] / _config / query_servers / python' / path / to / couchpy'

Update: Thank you Kxepal. It seems I was able to create the design/view on Futon in Python. Alternatively, I figured that python viewserver can be created as follows: curl -X PUT http://[localhost]/_config/query_servers/python '"/path/to/couchpy"'

但是,我仍然无法执行python脚本。在Couch上运行视图会导致以下结果:
'错误:访问视图时发生错误,无响应'

However, I still cannot execute the python script. Running the view on Couch results in following: 'Error: An error occurred accessing the view no response'

如果有人可以指出正确的地方,我将不胜感激方向。谢谢!

I would appreciate if somebody can point in the right direction. Thanks!

推荐答案

我不知道OSX是否保留CouchDB配置文件,但是您始终可以通过 Futon 。在边栏上,单击配置,然后单击页面底部的添加部分,然后使用与计划写入local.ini相同的数据填充字段。另外,您无需重启CouchDB-通过HTTP API进行的配置更改会立即应用,但请确保您指定了正确的值。

I don't know there OSX keeps CouchDB config files, but you always may setup Python query server through Futon. On sidebar click Configuration, than "Add section" at the bottom of the page and fill the fields with same data as you planned to write into local.ini. As bonus, you don't need restart CouchDB - configuration changes through HTTP API are applied instantly, but be sure that you'd specified correct values.

这篇关于为CouchDB设置Python ViewServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆