通过使用Python与CouchDB连接。我们必须安装以下软件包。
- Python解释器
- CouchDB数据库
- python-couchdb驱动程序
1)安装python-couchdb驱动程序
# pip install couchdb

文章图片
2)启动MongoDB服务
# service couchdb start

文章图片
3)创建一个Python脚本
# vi python-couch-connectivity.py

文章图片
// python-couch-connectivity.py
import couchdb# importing couchdb
# Connecting with couchdb Server
couch = couchdb.Server()
# Creating Database
db = couch.create('srcmini')
print("Database created");
# Creating document
doc = {'name':'Employee'}
db.save(doc) # Saving document
print("Document created")
# Fetching document from the database
print("Name is: "+doc['name'])
4)访问CouchDB
按照此URL http:// localhost:5984 / _utils访问localhost上的数据库。

文章图片
5)执行Python脚本
# python python-couch-connectivity.py

文章图片
6)访问创建的数据库

文章图片
参见, 储值。

文章图片
推荐阅读
- 使用Mango运行CouchDB查询
- php CouchDB连接实例
- Node.js连接CouchDB实例
- Java CouchDB连接详细实现步骤
- CouchDB的功能介绍
- CouchDB更新文档详细步骤
- CouchDB入门介绍
- CouchDB安装详细步骤
- CouchDB HTTP API详解