1. Alan Boyce
  2. django-couch-userdbs

Source

django-couch-userdbs /

Filename Size Date modified Message
userdbs
1.5 KB
1.1 KB
278 B

django-couch-userdbs

Provides per user couch databases for django.

Installation

Run the following command in this directory:

python setup.py install

Or manually by placing the "userdbs" folder somewhere in your python path

Setup

  1. add "userdbs" to your INSTALLED_APPS setting in "settings.py"
  2. add "COUCHDB_SERVER_URI" line pointing to your couch install. Usually "http://localhost:5984/" in "settings.py"
  3. add "DDOCS_ROOT" setting pointing to the directory containing your design docs in "settings.py"
  4. Run python manage.py syncdb

Usage

>>> import couchdbkit
>>> import settings
>>> server = couchdbkit.Server(settings.COUCHDB_SERVER_URI)

Create a database when we create a user
>>> from django.contrib.auth.models import User
>>> user = User.objects.create(username="bob")
>>> user.save()
>>> 'bob' in server.all_dbs()
True

Delete a database when we delete a user
>>> user.delete()
>>> 'bob' not in server.all_dbs()
True