You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2009/11/06 16:22:15 UTC
[Couchdb Wiki] Update of "Getting_started_with_Python" by DougShawhan
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "Getting_started_with_Python" page has been changed by DougShawhan.
http://wiki.apache.org/couchdb/Getting_started_with_Python?action=diff&rev1=12&rev2=13
--------------------------------------------------
Getting started with Python and the CouchDB API.
== Library ==
-
=== couchdbkit ===
-
- http://couchdbkit.org/
+ . http://couchdbkit.org/
Start using Couchdbkit by reading the [[http://couchdbkit.org/docs/gettingstarted.html|Getting Started tutorial]].
@@ -15, +13 @@
=== couchdb-python ===
The code for the Python library can be obtained from:
- http://code.google.com/p/couchdb-python
+ . http://code.google.com/p/couchdb-python
From a terminal window:
@@ -25, +23 @@
$ wget http://pypi.python.org/packages/2.5/C/CouchDB/CouchDB-0.6-py2.5.egg
$ sudo easy_install CouchDB-0.6-py2.5.egg
}}}
-
This first downloads and installs the ''ez_setup.py'' script which runs python ''.egg'' files. The second part downloads the ''.egg'' file for CouchDB and installs it along with its dependencies.
=== couchquery ===
-
- http://mikeal.github.com/couchquery/
+ . http://mikeal.github.com/couchquery/
-
== Tutorial on using couchdb-python with Django ==
-
A tutorial on using Django (a Python framework) with CouchDb can be found at
+ . http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb-with-django/ http://www.eflorenzano.com/blog/post/using-couchdb-django/
- http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb-with-django/
-
- http://www.eflorenzano.com/blog/post/using-couchdb-django/
Alternatively you can view just the source for that example at
- http://github.com/lethain/comfy-django-example/tree/master
+ . http://github.com/lethain/comfy-django-example/tree/master
== Example Wrapper Class ==
+ Demonstration of basic API-interaction using Python. (note: as of python 2.6, one can use "import json" for the same functionality in this script.)
-
- Demonstration of basic API-interaction using Python.
{{{#!python
#! /usr/bin/python2.4
@@ -116, +107 @@
r = self.post(''.join(['/', dbName, '/']), body)
prettyPrint(r)
- def deleteDoc(self, dbName, docId):
+ def deleteDoc(self, dbName, docId):
# XXX Crashed if resource is non-existent; not so for DELETE on db. Bug?
- # XXX Does not work any more, on has to specify an revid
+ # XXX Does not work any more, on has to specify an revid
# Either do html head to get the recten revid or provide it as parameter
r = self.delete(''.join(['/', dbName, '/', docId]))
prettyPrint(r)
@@ -151, +142 @@
c.request("DELETE", uri)
return c.getresponse()
}}}
-
== Usage Example ==
-
{{{#!python
def test():
foo = Couch('localhost', '5984')
@@ -206, +195 @@
if __name__ == "__main__":
test()
}}}
-
== Sample Output ==
-
{{{#!java
Create database 'mydb':
{